Skip to content

Instantly share code, notes, and snippets.

@nikhilatjumpcut
Created August 3, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilatjumpcut/9f1bc22fb8eeccd787f91546c7754e4b to your computer and use it in GitHub Desktop.
Save nikhilatjumpcut/9f1bc22fb8eeccd787f91546c7754e4b to your computer and use it in GitHub Desktop.
replaceReleaseDates.js
function getElementByTagAndText(tag, text) {
var xPath = "//" + tag + "[contains(text(), '" + text + "')]";
return document.evaluate(xPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function getDate(timewaitValue) {
if (!timewaitValue || !spacetime) {
return 'soon';
}
return spacetime(timewaitValue).format("{month-short} {date-ordinal}");
}
function replaceReleaseDates() {
// get all the durations for all the steps
var timewaitStops = window.__TSUNAMI__.timewaitStops;
if (!timewaitStops) {
return;
}
var $node = getElementByTagAndText('b', 'Releasing Jan. 21st');
var date = getDate(timewaitStops[1]);
$node.innerText = "Releasing " + date;
$node = getElementByTagAndText('b', 'Releasing Jan. 23rd');
date = getDate(timewaitStops[2]);
$node.innerText = "Releasing " + date;
$node = getElementByTagAndText('b', 'Releasing Jan. 24th');
date = getDate(timewaitStops[3]);
$node.innerText = "Releasing " + date;
return;
}
replaceReleaseDates();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment