Skip to content

Instantly share code, notes, and snippets.

@will
Created January 19, 2010 22:57
Show Gist options
  • Save will/281402 to your computer and use it in GitHub Desktop.
Save will/281402 to your computer and use it in GitHub Desktop.
<html>
<head>
<script language="javascript"
type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"
></script>
<style type="text/css" media="screen">
body {
font: 15em Helvetica, Arial, sans-serif;
text-align: center;
font-weight: bold;
}
#page {
margin-top: 200px;
}
.SUCCESS {
color: rgb(17,145,17);
background-color: rgb(11,71,11);
text-shadow: rgb(126,236,126) 0px 2px 0px;
}
.FAILURE, .ABORTED {
color: rgb(145,17,17);
background-color: rgb(71,11,11);
text-shadow: rgb(236,126,126) 0px 2px 0px;
}
.BUILDING {
color: rgb(145,145,145);
background-color: rgb(71,71,71);
text-shadow: rgb(236,236,236) 0px 2px 0px;
}
</style>
<script language="javascript">
// Hudson CI Radiator
// Will Leinweber
//
// edit the URL in the getJSON call to point at your build
var pulse = function() {
$(".pulse").delay(1500).fadeTo(600,0.1).delay(1).fadeTo(600,1);
};
var update = function() {
build = build ? build : "lastBuild"
$.getJSON("http://YOURHUDSON/job/YOURJOB/lastBuild/api/json?jsonp=?",
function(data) {
var sha = data.actions[1].lastBuiltRevision.SHA1.substring(0,7);
var building = data.building;
var result = data.result; // SUCCESS, FAILURE, ABORTED
var message = building ? "BUILDING" : result;
$("#message").text(message);
$("#build").text(sha);
$("#body").removeClass().addClass(message);
$("#page").toggleClass( "pulse", "SUCCESS" != message);
});
};
$(function() {
update();
setInterval( update, 1000 );
setInterval( pulse, 2000 );
});
</script>
<body id="body">
<div id="page">
<div id="message"></div>
<div id="build"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment