Boomer Text

Background boomer music

  1. // ==UserScript==
  2. // @name Boomer Text
  3. // @version 0.1
  4. // @license MIT
  5. // @author @roescoe
  6. // @grant GM_openInTab
  7. // @match *://*/*
  8. // @description Background boomer music
  9. // @namespace https://greasyfork.org/users/985766
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. let phrases =[
  14. "boomer",
  15. "boomers",
  16. "back in my day",
  17. "kids these days",
  18. "spending the kid's inheritance",
  19. "spending the kids' inheritance",
  20. "spending the kids' inheritance",
  21. "bootstraps",
  22. "values of responsibility",
  23. "value of responsibility",
  24. "respect our elders",
  25. "respect our elder",
  26. "respect your elders",
  27. "respect your elder",
  28. "pay off your student loans",
  29. "get the job",
  30. ];
  31. document.addEventListener('mouseup', function(){
  32. var thetext = getSelectionText()
  33. if (thetext.length > 0){ // check there's some text selected
  34. for (let i in phrases) {
  35. if (thetext.toUpperCase().includes(phrases[i].toUpperCase())) {
  36. window.getSelection().removeAllRanges();
  37. playMusic();
  38. break;
  39. }
  40. }
  41. }
  42. }, false)
  43. function getSelectionText() {
  44. var text = "";
  45. if (window.getSelection) {
  46. text = window.getSelection().toString();
  47. } else if (document.selection && document.selection.type != "Control") {
  48. text = document.selection.createRange().text;
  49. }
  50. return text;
  51. }
  52.  
  53.  
  54. function playMusic() {
  55. var boomerMusic = GM_openInTab ("https://on.soundcloud.com/GDeUT");
  56. console.log("boomer Music plays...");
  57. };
  58.  
  59. })();