Skip to content

Instantly share code, notes, and snippets.

@timsavery
Last active August 29, 2015 14:10
Show Gist options
  • Save timsavery/6ce46595e7a14cd49229 to your computer and use it in GitHub Desktop.
Save timsavery/6ce46595e7a14cd49229 to your computer and use it in GitHub Desktop.
var hiddenText = document.querySelector("#tfa_218");
var submitButton = document.querySelector("input[value='Submit']");
var nextPageButton = document.querySelector("input[value='Next Page']");
var previousPageButton = document.querySelector("input[value='Previous Page']");
var disableButtons = function () {
if (submitButton) {
submitButton.style.display = 'none';
}
if (nextPageButton) {
nextPageButton.style.display = 'none';
}
if (previousPageButton) {
previousPageButton.style.display = 'none';
}
hiddenText.style.display = 'block';
};
var enableButtons = function () {
if (submitButton) {
submitButton.style.display = 'block';
}
if (nextPageButton) {
nextPageButton.style.display = 'block';
}
if (previousPageButton) {
previousPageButton.style.display = 'block';
}
hiddenText.style.display = 'none';
};
var doLoad = function () {
var nyc = moment.tz(new Date(), "America/New_York");
if (nyc.date() === 28 && nyc.minutes() >= 31) {
return enableButtons();
}
disableButtons();
if (nyc.date() === 28 && nyc.minutes() < 31) {
var shouldEnableButtons = function () {
return (moment.tz(new Date(), "America/New_York").minutes() >= 31);
};
var shouldEnableButtonsInterval = setInterval(function () {
if (shouldEnableButtons()) {
enableButtons();
clearInterval(shouldEnableButtonsInterval);
}
}, 5000);
}
}
if (window.addEventListener) {
window.addEventListener("load", doLoad, false);
} else if (window.attachEvent) {
window.attachEvent("onload", doLoad);
} else {
window.onload = doLoad;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment