Permalink
Browse files

Dynamically fetch latest version for download button.

  • Loading branch information...
1 parent 5a2a558 commit c60d8ec67b26c43612ff4e775c3600976e9eafe7 @JakeWharton JakeWharton committed Sep 9, 2012
Showing with 18 additions and 1 deletion.
  1. +18 −1 website/index.html
View
@@ -18,7 +18,7 @@
<h1>Pollexor</h1>
<h3>Java client for the <a href="http://github.com/globocom/thumbor">Thumbor image service</a> which allows you to build URIs in an expressive fashion using a fluent API.</h3>
<ul class="unstyled">
- <li><a href="http://github.com/square/pollexor" class="btn btn-large btn-inverse">Download v1.1.0</a></li>
+ <li><a href="http://github.com/square/pollexor" class="btn btn-large btn-inverse" id="download">Download</a></li>
</ul>
</div>
</div>
@@ -83,5 +83,22 @@ <h5>Full URL Construction</h5>
</div>
<script src="prettify.js"></script>
<script> prettyPrint(); </script>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script>
+ $.getJSON('https://api.github.com/repos/square/pollexor/tags?callback=?', function(response) {
+ var meta = response.meta
+ , data = response.data
+ ;
+
+ data.sort(function(o1, o2) {
+ return (o1.name > o2.name) ? -1 : 1;
+ });
+
+ // Ensure we only get the version information.
+ var last = data[0].name.match(/\d+\.\d+\.\d+/);
+
+ $('#download').text('Download v' + last);
+ });
+</script>
</body>
</html>

0 comments on commit c60d8ec

Please sign in to comment.