Userscript that puts lines from "Hello, Dolly!" in the top bar of Tangled.
at main 65 lines 2.0 kB view raw
1// ==UserScript== 2// @name Hello, Dolly! 3// @description Displays lyrics from the song "Hello Dolly" by Jerry Herman 4// @author HotSocket 5// @downloadURL https://tangled.org/did:plc:jlplwn5pi4dqrls7i6dx2me7/hello-dolly/raw/main/hello.user.js 6// @match *://tangled.org/* 7// @match *://tangled.sh/* 8// @version 1.1 9// ==/UserScript== 10 11function hello_dolly_get_lyric() { 12 /** These are the lyrics to Hello Dolly */ 13 const lyrics = `Hello, Dolly 14Well, hello, Dolly 15It's so nice to have you back where you belong 16You're lookin' swell, Dolly 17I can tell, Dolly 18You're still glowin', you're still crowin' 19You're still goin' strong 20I feel the room swayin' 21While the band's playin' 22One of our old favorite songs from way back when 23So, take her wrap, fellas 24Dolly, never go away again 25Hello, Dolly 26Well, hello, Dolly 27It's so nice to have you back where you belong 28You're lookin' swell, Dolly 29I can tell, Dolly 30You're still glowin', you're still crowin' 31You're still goin' strong 32I feel the room swayin' 33While the band's playin' 34One of our old favorite songs from way back when 35So, golly, gee, fellas 36Have a little faith in me, fellas 37Dolly, never go away 38Promise, you'll never go away 39Dolly'll never go away again`; 40 41 // Here we split it into lines. 42 const lines = lyrics.split("\n"); 43 44 // And then randomly choose a line. 45 return lines[Math.max(0, Math.round((Math.random()*lines.length) - 1))]; 46} 47 48// This just creates the element for the chosen line, we'll position it later. 49function hello_dolly() { 50 const chosen = hello_dolly_get_lyric(); 51 52 const el = document.createElement("span"); 53 el.classList.add("text-gray-700", "dark:text-gray-400"); 54 el.textContent = chosen; 55 el.ariaLabel = `Quote from Hello Dolly song, by Jerry Herman: ${chosen}`; 56 57 return el; 58} 59 60const leftItems = document.getElementById("left-items"); 61leftItems.style.display = "flex"; 62leftItems.style.alignItems = "center"; 63leftItems.style.gap = "1em"; 64 65leftItems.appendChild(hello_dolly());