mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 09:03:29 +00:00
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
|
$(document).ready(function(){
|
||
|
|
||
|
$.getJSON("_site/examples.json")
|
||
|
|
||
|
.done(function(data) {
|
||
|
|
||
|
var i = 0;
|
||
|
var node = '';
|
||
|
|
||
|
$.each(data, function(dir, files)
|
||
|
{
|
||
|
node = '<h2>' + dir + '</h2>';
|
||
|
|
||
|
for (var e = 0; e < files.length; e++)
|
||
|
{
|
||
|
node += '<a href="_site/view_lite.html?d=' + dir + '&f=' + files[e].file + '&t=' + files[e].title + '" target="viewer">' + files[e].title + '</a><br />';
|
||
|
}
|
||
|
|
||
|
$("#examples-list").append(node);
|
||
|
|
||
|
i += files.length;
|
||
|
|
||
|
});
|
||
|
|
||
|
$("#total").append(i);
|
||
|
|
||
|
// Re-calc the viewer height
|
||
|
var height = $(window).height() - 270;
|
||
|
$("#panel").css('height', height + 'px');
|
||
|
|
||
|
})
|
||
|
|
||
|
.fail(function() {
|
||
|
|
||
|
var node = '<h1>Error!</h1>';
|
||
|
|
||
|
node += '<p>Unable to load <u>examples.json</u> data file</p>';
|
||
|
node += '<p>Did you open this html file locally?</p>';
|
||
|
node += '<p>It needs to be opened via a web server, or due to browser security permissions<br />it will be unable to load local resources such as images and json data.</p>';
|
||
|
node += '<p>Please see our <a href="#">Getting Started guide</a> for details.</p>';
|
||
|
|
||
|
$("#viewer").contents().find('body').append(node);
|
||
|
|
||
|
});
|
||
|
|
||
|
});
|