Colorful Paragraphs

Takes a 'p' tag. Fucks it up and spits out a fucking rainbow!! Making text practically un-readable.

  1. // ==UserScript==
  2. // @name Colorful Paragraphs
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Takes a 'p' tag. Fucks it up and spits out a fucking rainbow!! Making text practically un-readable.
  6. // @author feedmegrizzly
  7. // @match https://*/*
  8. // @match http://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. window.onload = function(){
  13. var colors = ["red", "green", "blue", "teal", "fuchsia", "purple", "orange"];
  14. var paragraphs = document.querySelectorAll('p');
  15.  
  16. //-----------------------------------------------------
  17.  
  18. function get_words(paragraphs){
  19. var result = []
  20. for(var paragraph of paragraphs){
  21. try{
  22. result.push(paragraph.innerText.split(""));
  23. }
  24. catch(err){console.log(err)}
  25. }
  26. return result
  27. };
  28.  
  29. //-----------------------------------------------------
  30.  
  31. function add_color_style(paragraphs, colors){
  32. var color_index = 0
  33. for(var i = 0; i < paragraphs.length; i++){
  34. for(var j = 0; j < paragraphs[i].length; j++){
  35. if(color_index >= colors.length){
  36. color_index = 0
  37. }
  38. paragraphs[i][j] = "<span style='color:" + colors[color_index] + "'>" + paragraphs[i][j] + "</span>"
  39. color_index++
  40. }
  41. paragraphs[i] = paragraphs[i].join("")
  42. }
  43. set_text_to_dom(paragraphs)
  44. };
  45.  
  46. //-----------------------------------------------------
  47.  
  48. function set_text_to_dom(paragraphs){
  49. var old_p = document.querySelectorAll('p');
  50. for(var i = 0; i < old_p.length; i++){
  51. old_p[i].innerHTML = paragraphs[i]
  52. }
  53. return
  54. }
  55.  
  56.  
  57. add_color_style(get_words(paragraphs),colors);
  58. }

QingJ © 2025

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