Skip to content

Instantly share code, notes, and snippets.

@korkey128k
Created April 27, 2024 02:04
Show Gist options
  • Save korkey128k/2d56f5d1b69efb264df88b099e8338cb to your computer and use it in GitHub Desktop.
Save korkey128k/2d56f5d1b69efb264df88b099e8338cb to your computer and use it in GitHub Desktop.
Show local time on spc.nws.gov
// ==UserScript==
// @name NWS Thunderstorm outloook; Show local time
// @namespace http://tampermonkey.net/
// @version 2024-04-26
// @description The NWS provides great maps! Their web interface needs help.
// @author You
// @match https://www.spc.noaa.gov/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=noaa.gov
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.querySelectorAll('#elements td').forEach(el => {
let matcher = el.textContent.match(/\d\d/g),
start = matcher[0],
end = matcher[1],
times = []
if(start && end) {
times[0] = new Date(); times[0].setUTCHours(start)
times[1] = new Date(); times[1].setUTCHours(end)
el.querySelector('a').textContent = `${times[0].getHours()}L-${times[1].getHours()}L`
}
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment