Skip to content

Instantly share code, notes, and snippets.

@TheLukeGuy
Last active January 16, 2023 19:46
Show Gist options
  • Save TheLukeGuy/fb1d54a60a3d78336251f3c81e7858c6 to your computer and use it in GitHub Desktop.
Save TheLukeGuy/fb1d54a60a3d78336251f3c81e7858c6 to your computer and use it in GitHub Desktop.
Changes the icons on National Weather Service's forecast pages to the old set of icons.
// ==UserScript==
// @name NWS Old Icons
// @namespace http://lpx.sh/
// @version 0.6.2
// @description Changes the icons on National Weather Service's forecast pages to the old set of icons.
// @author Luke
// @match *://forecast.weather.gov/MapClick.php*
// @grant none
// ==/UserScript==
(function() {
"use strict";
// Replace the icons
document.body.innerHTML = document.body.innerHTML
.replace(/newimages\/medium\/hourlyweather.png/g, "newimages//medium/hourlyweather.png")
.replace(/newimages\/(small|medium|large)/g, "images//wtf")
.replace(/(?<=images\/\/wtf\/[a-z_0-9]*).png/g, ".jpg")
.replace(/DualImage\.php\?i=/g, "images///wtf/")
.replace(/(?<=images\/\/\/wtf\/[a-z_]*)(&|&amp;)j=[a-z_]*/g, "")
.replace(/(?<=images\/\/\/wtf\/[^"]*)(&|&amp;)jp=[0-9]*/g, "")
.replace(/(?<=images\/\/\/wtf\/[a-z_]*)(&|&amp;)ip=/g, "")
.replace(/(?<=images\/\/\/wtf\/[a-z_0-9]*)"/g, ".jpg\"")
.replace(/(?<=images)\/+/g, "/")
.replace(/(?<=images\/wtf\/)(n)?ra_sn/g, "$1rasn")
.replace(/(?<=images\/wtf\/)(n)?wind_[a-z]{3}/g, "$1wind")
.replace(/(?<=images\/wtf\/)(n)?(fzra_sn|sn_ip)/g, "$1mix")
.replace(/(?<=images\/wtf\/)nmix/g, "mix")
.replace(/(?<=images\/wtf\/)(n)?ra_fzra/g, "$1raip");
// Fix the map
$("body").html($("body").html());
$(".ol-viewport").first().remove();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment