Skip to content

Instantly share code, notes, and snippets.

@jacobstanley
Created November 7, 2011 08:54
Show Gist options
  • Save jacobstanley/1344490 to your computer and use it in GitHub Desktop.
Save jacobstanley/1344490 to your computer and use it in GitHub Desktop.
body {
-moz-animation-name: roll;
-moz-animation-duration: 4s;
-moz-animation-iteration-count: 1;
-o-animation-name: roll;
-o-animation-duration: 4s;
-o-animation-iteration-count: 1;
-webkit-animation-name: roll;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: 1;
background: black;
font-color: red;
}
var canHasRollinz = true;
function barrelRoll() {
var transform = canHasRollinz ? "rotate(360deg)" : "rotate(0deg)";
var x = document.body.style;
x.setProperty("-moz-transform", transform);
x.setProperty("-moz-transition-duration", "4s");
x.setProperty("-moz-transition-property", "all");
x.setProperty("-o-transform", transform);
x.setProperty("-o-transition-duration", "4s");
x.setProperty("-o-transition-property", "all");
x.setProperty("-webkit-transform", transform);
x.setProperty("-webkit-transition-duration", "4s");
x.setProperty("-webkit-transition-property", "all");
canHasRollinz = !canHasRollinz;
}
document.body.onload = function () {
function toA(x) { return Array.prototype.slice.call(x); }
var inputs = toA(document.getElementsByTagName("input"));
//var anchors = toA(document.getElementsByTagName("a"));
var xs = inputs; //inputs.concat(anchors);
for (var i = 0; i < xs.length; i++) {
var x = xs[i];
(function () {
var previous = x.onclick || function () {};
var previousHref = x.href || "javascript:void(0);";
x.href = null;
x.onclick = function (e) {
barrelRoll();
setTimeout(function () {
previous();
if (previousHref != null) {
window.location = previousHref;
}
}, 4000);
}
})();
}
}
document.forms['frmAprvTS'].elements['approve'].checked = true;
document.forms['frmAprvTS'].submit();
function checkHrs()
{
if (document.forms['frmAprvTS'].isFullTime.value == 'true')
{
if (document.forms['frmAprvTS'].totalHrs.value < 38)
{
var accept = confirm("Full time staff should not have less than 38 hours. Do you want to do a barrel roll instead?");
if (accept)
{
barrelRoll();
}
else
document.forms['frmAprvTS'].elements['approve'].checked = false;
}
else
document.forms['frmAprvTS'].submit();
}
else
document.forms['frmAprvTS'].submit();
}
@TrevorSayre
Copy link

(function () {
  const x = document.body.style;
  const transform = x.transform === "rotate(360deg)" ? "rotate(0deg)" : "rotate(360deg)";
  x.setProperty("transform", transform);
  x.setProperty("transition-duration", "1s");
  x.setProperty("transition-property", "all");
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment