Created
August 3, 2019 14:32
-
-
Save nikhilatjumpcut/9f1bc22fb8eeccd787f91546c7754e4b to your computer and use it in GitHub Desktop.
replaceReleaseDates.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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