$(document).ready(function(){ $.getJSON("_site/examples.json") .done(function(data) { var i = 0; var t = 0; var len = 0; var node = ''; var laser = ''; var directories = Object.keys(data); directories.splice(directories.indexOf('basics'), 1); directories.splice(directories.indexOf('games'), 1); directories.sort(); directories.unshift('basics', 'games'); directories.forEach(function(dir) { var files = data[dir]; len = Math.floor(files.length / 4) + 1; if ((files.length / 4) % 1 == 0) { len--; } if (len > 9) { laser = 'laser10'; } else { laser = 'laser' + len; } if (i == 1) { node = '
'; } else if (i == 2) { node = '
'; } node += '

' + dir + '

'; node += '

' + files.length + ' examples

'; node += '
'; $("#examples-list").append(node); i++; if (i == 3) { i = 1; } }); $("#total").append(t); }) .fail(function() { var node = '
'; node += '

Error!

'; node += '

:(

'; node += '

Unable to load examples.json data file

'; node += '

Did you open this html file locally?

'; node += '

It needs to be opened via a web server, or due to browser security permissions
it will be unable to load local resources such as images and json data.

'; node += '

Please see our Getting Started guide for details.

'; node += '
'; node += '
'; $("#examples-list").append(node); }); $.getJSON("http://phaser.io/version.json") .done(function(data) { console.log(data); if (data.version !== '1.1.3') { $("#upgrade").append(data.version); $("#upgrade").css('display', 'inline-block'); } }); });