Skip to content

Instantly share code, notes, and snippets.

@Mailaender
Created March 17, 2013 09:18
Show Gist options
  • Save Mailaender/5180786 to your computer and use it in GitHub Desktop.
Save Mailaender/5180786 to your computer and use it in GitHub Desktop.
OpenRA Master Server server list display
<!DOCTYPE html>
<html>
<head>
<title>OpenRA Master Server</title>
</head>
<body>
<h1>OpenRA Master Server</h1>
<div id="list"></div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript" src="handlebars-0.9.0.pre.5.js"></script>
<script id="serverlist-template" type="text/x-handlebars-template">
<ul>
{{#each games}}
<li>{{name}} ({{id}})</li>
{{/each}}
</ul>
</script>
<script type="text/javascript">
$(document).ready(function() {
// compile our template
var template = Handlebars.compile($("#serverlist-template").html());
var games = { "games": [] };
var data = $.get("list_json.txt", function() {
alert("success");
$.extend(games, data);
})
$('#list').html(template(games));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment