| 1 |
(function() { |
| 2 |
"use strict"; |
| 3 |
const WIDGET_ID = "desktop-mode/jazz-quote"; |
| 4 |
const WP_CODENAMES = { |
| 5 |
7: "Louis Armstrong", |
| 6 |
6.9: "Gene Harris", |
| 7 |
6.8: "Cecil Taylor", |
| 8 |
6.7: "Sonny Rollins", |
| 9 |
6.6: "Tommy Dorsey", |
| 10 |
6.5: "Regina Carter", |
| 11 |
6.4: "Shirley Horn", |
| 12 |
6.3: "Lionel Hampton", |
| 13 |
6.2: "Eric Dolphy", |
| 14 |
// "Dolphy" — woodwind multi-instrumentalist |
| 15 |
6.1: "Mikhail Alperin", |
| 16 |
// "Misha" — jazz pianist/composer (NOT Misha Dichter) |
| 17 |
6: "Arturo O'Farrill", |
| 18 |
// "Arturo" — Latin jazz pianist |
| 19 |
5.9: "Joséphine Baker", |
| 20 |
// "Josephine" |
| 21 |
5.8: "Art Tatum", |
| 22 |
// "Tatum" |
| 23 |
5.7: "Esperanza Spalding", |
| 24 |
// "Esperanza" |
| 25 |
5.6: "Nina Simone", |
| 26 |
// "Simone" |
| 27 |
5.5: "Billy Eckstine", |
| 28 |
// "Eckstine" |
| 29 |
5.4: "Nat Adderley", |
| 30 |
// "Adderley" |
| 31 |
5.3: "Rahsaan Roland Kirk", |
| 32 |
// "Kirk" |
| 33 |
5.2: "Jaco Pastorius", |
| 34 |
// "Jaco" |
| 35 |
5.1: "Betty Carter", |
| 36 |
// "Betty" |
| 37 |
5: "Bebo Valdés" |
| 38 |
// "Bebo" |
| 39 |
}; |
| 40 |
const MUSICIAN_QUOTES = { |
| 41 |
"Louis Armstrong": [ |
| 42 |
"If you have to ask what jazz is, you'll never know.", |
| 43 |
"Musicians don't retire; they stop when there's no more music in them.", |
| 44 |
"All music is folk music. I ain't never heard a horse sing a song." |
| 45 |
], |
| 46 |
"Gene Harris": [ |
| 47 |
"Play from your heart and the rest will follow.", |
| 48 |
"The blues is the roots; everything else is the fruits.", |
| 49 |
"Swing is a feeling, not a formula." |
| 50 |
], |
| 51 |
"Cecil Taylor": [ |
| 52 |
"Music has to do with a lot of areas which are magical rather than logical.", |
| 53 |
"The piano is a vehicle by which I can express my spirit.", |
| 54 |
"I try to imitate on the piano the leaping of a plant." |
| 55 |
], |
| 56 |
"Sonny Rollins": [ |
| 57 |
"Jazz is not just music — it's a way of life.", |
| 58 |
"If you're not making a mistake, it's a mistake.", |
| 59 |
"Playing is the easiest way for me to communicate with other people." |
| 60 |
], |
| 61 |
"Tommy Dorsey": [ |
| 62 |
"A real pro is someone who does their best work even when they don't feel like it.", |
| 63 |
"Make it swing and the people will follow.", |
| 64 |
"The trombone is the voice of the orchestra." |
| 65 |
], |
| 66 |
"Regina Carter": [ |
| 67 |
"The violin is not a barrier — it is a bridge.", |
| 68 |
"I never wanted to be put in a box.", |
| 69 |
"Swing is not a tempo. It is an attitude." |
| 70 |
], |
| 71 |
"Shirley Horn": [ |
| 72 |
"Space is where music lives.", |
| 73 |
"A slow tempo is a brave tempo.", |
| 74 |
"Every note needs room to breathe." |
| 75 |
], |
| 76 |
"Lionel Hampton": [ |
| 77 |
"I just hit the vibraphone and let God take over.", |
| 78 |
"You can always tell a musician by the way they listen.", |
| 79 |
"Jazz is the music of the moment that lasts forever." |
| 80 |
], |
| 81 |
"Eric Dolphy": [ |
| 82 |
"When you hear music, after it's over, it's gone in the air. You can never capture it again.", |
| 83 |
"I play a little different on each instrument.", |
| 84 |
"Music is a reflection of everything — and that includes all kinds of beauty." |
| 85 |
], |
| 86 |
"Mikhail Alperin": [ |
| 87 |
"Music is about finding your own voice, not someone else's.", |
| 88 |
"Silence is part of music — the space between notes is where meaning lives.", |
| 89 |
"Every note I play comes from somewhere inside that I cannot explain." |
| 90 |
], |
| 91 |
"Arturo O'Farrill": [ |
| 92 |
"Latin jazz is the only truly American music.", |
| 93 |
"Music is the universal language — and jazz is its most democratic dialect.", |
| 94 |
"My job is to swing hard and think deep." |
| 95 |
], |
| 96 |
"Joséphine Baker": [ |
| 97 |
"The most beautiful thing in the world is freedom.", |
| 98 |
"I improvised, caricatured, and made people laugh.", |
| 99 |
"One word frees us of all the weight and pain of life — that word is love." |
| 100 |
], |
| 101 |
"Art Tatum": [ |
| 102 |
"I'm always trying to do things differently.", |
| 103 |
"The piano is a complete orchestra.", |
| 104 |
"Speed is nothing without control." |
| 105 |
], |
| 106 |
"Nina Simone": [ |
| 107 |
"Jazz is not just music — it's life.", |
| 108 |
"I'll tell you what freedom is to me: no fear.", |
| 109 |
"You've got to learn to leave the table when love's no longer being served." |
| 110 |
], |
| 111 |
"Esperanza Spalding": [ |
| 112 |
"Music is a living thing.", |
| 113 |
"I want to create something that is beyond genre.", |
| 114 |
"A song is a conversation between the singer and the listener." |
| 115 |
], |
| 116 |
"Bebo Valdés": [ |
| 117 |
"Cuban music is the most complete in the world.", |
| 118 |
"You play with what you have, and you make it beautiful.", |
| 119 |
"Music is the bridge between where you are and where you want to be." |
| 120 |
] |
| 121 |
}; |
| 122 |
const JAZZ_WISDOM = [ |
| 123 |
"Do not fear mistakes — there are none. — Miles Davis", |
| 124 |
"Man, if you gotta ask, you'll never know. — Louis Armstrong", |
| 125 |
"There are no wrong notes in jazz: only notes in the wrong places. — Miles Davis", |
| 126 |
"Music is your own experience, your thoughts, your wisdom. If you don't live it, it won't come out of your horn. — Charlie Parker", |
| 127 |
"You can play a shoestring if you're sincere. — John Coltrane", |
| 128 |
"Jazz is the music of the body. — Anita O'Day", |
| 129 |
"I'm always thinking about creating. My future starts when I wake up every morning. — Miles Davis", |
| 130 |
"It takes a long time to play like yourself. — Miles Davis", |
| 131 |
"Don't play what's there — play what's not there. — Miles Davis" |
| 132 |
]; |
| 133 |
function detectWpVersion() { |
| 134 |
const inlined = window.desktopModeJazzQuote?.wpVersion; |
| 135 |
if (inlined && /^\d+\.\d+/.test(inlined)) { |
| 136 |
return inlined; |
| 137 |
} |
| 138 |
const meta = document.querySelector('meta[name="generator"]'); |
| 139 |
const match = meta?.content?.match(/WordPress ([\d.]+)/); |
| 140 |
if (match) { |
| 141 |
return match[1]; |
| 142 |
} |
| 143 |
return null; |
| 144 |
} |
| 145 |
function majorVersion(version) { |
| 146 |
return version.split(".").slice(0, 2).join("."); |
| 147 |
} |
| 148 |
function todayKey() { |
| 149 |
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10); |
| 150 |
} |
| 151 |
function dayOfYearSeed() { |
| 152 |
const now = /* @__PURE__ */ new Date(); |
| 153 |
const start = new Date(now.getFullYear(), 0, 0); |
| 154 |
const diff = now.getTime() - start.getTime(); |
| 155 |
return Math.floor(diff / 864e5); |
| 156 |
} |
| 157 |
function pickQuote(musician) { |
| 158 |
const pool = musician ? MUSICIAN_QUOTES[musician] ?? JAZZ_WISDOM : JAZZ_WISDOM; |
| 159 |
return pool[dayOfYearSeed() % pool.length]; |
| 160 |
} |
| 161 |
function render(container, version, musician, quote) { |
| 162 |
container.innerHTML = ""; |
| 163 |
const root = document.createElement("div"); |
| 164 |
root.className = "dm-jazz"; |
| 165 |
const symbol = document.createElement("div"); |
| 166 |
symbol.className = "dm-jazz__symbol"; |
| 167 |
symbol.setAttribute("aria-hidden", "true"); |
| 168 |
symbol.textContent = "♫"; |
| 169 |
const quoteEl = document.createElement("blockquote"); |
| 170 |
quoteEl.className = "dm-jazz__quote"; |
| 171 |
quoteEl.textContent = quote; |
| 172 |
const attr = document.createElement("div"); |
| 173 |
attr.className = "dm-jazz__attr"; |
| 174 |
if (musician) { |
| 175 |
const nameEl = document.createElement("span"); |
| 176 |
nameEl.className = "dm-jazz__musician"; |
| 177 |
nameEl.textContent = musician; |
| 178 |
attr.appendChild(nameEl); |
| 179 |
} |
| 180 |
if (version) { |
| 181 |
const wpEl = document.createElement("span"); |
| 182 |
wpEl.className = "dm-jazz__version"; |
| 183 |
wpEl.textContent = "WordPress " + version + (musician ? "" : " — jazz wisdom"); |
| 184 |
attr.appendChild(wpEl); |
| 185 |
} |
| 186 |
root.appendChild(symbol); |
| 187 |
root.appendChild(quoteEl); |
| 188 |
root.appendChild(attr); |
| 189 |
container.appendChild(root); |
| 190 |
} |
| 191 |
const mount = async (container, ctx) => { |
| 192 |
const stored = ctx.storage.get("daily"); |
| 193 |
const today = todayKey(); |
| 194 |
if (stored && stored.date === today) { |
| 195 |
render(container, stored.version, stored.musician, stored.quote); |
| 196 |
return () => void 0; |
| 197 |
} |
| 198 |
const version = detectWpVersion(); |
| 199 |
const major = version ? majorVersion(version) : null; |
| 200 |
const musician = major ? WP_CODENAMES[major] ?? null : null; |
| 201 |
const quote = pickQuote(musician); |
| 202 |
ctx.storage.set("daily", { date: today, quote, musician, version }); |
| 203 |
render(container, version, musician, quote); |
| 204 |
return () => void 0; |
| 205 |
}; |
| 206 |
const w = window; |
| 207 |
w.desktopModeWidgets = w.desktopModeWidgets ?? {}; |
| 208 |
w.desktopModeWidgets[WIDGET_ID] = mount; |
| 209 |
})(); |
| 210 |
|