Skip to content

Instantly share code, notes, and snippets.

@Tcip
Created May 20, 2025 18:34
Show Gist options
  • Select an option

  • Save Tcip/e3cce93bfa27b8231058c040b742e269 to your computer and use it in GitHub Desktop.

Select an option

Save Tcip/e3cce93bfa27b8231058c040b742e269 to your computer and use it in GitHub Desktop.
Displays countdown for Bounties battle in the title for Embervale
javascript:(function()%7Bconst%20t%3Ddocument.querySelectorAll(%22div%5Bdata-v-03734b34%5D%5Bstyle%3D'justify-content%3A%20space-around%3B'%5D%22)%2Ce%3Dt%5B0%5D.textContent.match(%2F(%5Cd%2B)%5Cs*Minutes%5Cs*(%5Cd%2B)%5Cs*Seconds%2F)%2Cn%3De%3F60*Number(e%5B1%5D)%2BNumber(e%5B2%5D)%3A0%3Bfunction%20updateTitle()%7Blet%20t%3Dperformance.now()%2Ce%3DMath.round((t-o)%2F1e3)%2Ca%3DMath.max(0%2Cn-e)%3Bdocument.title%3D%60%E2%8F%B3%3A%20%24%7Ba%7Ds%60%2Ca%3E0%3FrequestAnimationFrame(updateTitle)%3Adocument.title%3D%22%E2%9A%94%20Fight!%22%7Dlet%20o%3Dperformance.now()%3BupdateTitle()%7D)()
(function() {
const t = document.querySelectorAll("div[data-v-03734b34][style='justify-content: space-around;']"),
e = t[0].textContent.match(/(\d+)\s*Minutes\s*(\d+)\s*Seconds/),
n = e ? 60 * Number(e[1]) + Number(e[2]) : 0;
function updateTitle() {
let t = performance.now(),
e = Math.round((t - o) / 1e3),
a = Math.max(0, n - e);
document.title = `⏳: ${a}s`, a > 0 ? requestAnimationFrame(updateTitle) : document.title = "⚔ Fight!"
}
let o = performance.now();
updateTitle()
})()
@EmbervaleTV
Copy link

Very cool idea! Implemented something similar. Thank you for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment