Permalink
Browse files

Only show the galleria when there are images available. Closes #3

The script was showing the galleria instance when resources.json was
ready. However, the images take some time to get generated, and galleria
was trying to load them when the images do not exist yet. This commit
fixes the problem.
  • Loading branch information...
1 parent 7204dcd commit b654d945fa070766d929508efd4e376db208262d @teleyinex teleyinex committed Dec 27, 2011
Showing with 21 additions and 18 deletions.
  1. +21 −18 js/test4theory.js
View
@@ -31,25 +31,28 @@ function getBoincData() {
function getResources() {
$.getJSON('job/resources.json', function(data){
- $("#waiting").hide();
- $("#container").show();
- // Output the jobMetaData
- $("#info").append('<strong>Beam:</strong> ' + data.jobMetaData.Beam + '</br>');
- $("#info").append('<strong>Process:</strong> ' + data.jobMetaData.Process + '</br>');
- $("#info").append('<strong>Energy:</strong> ' + data.jobMetaData.Energy + '</br>');
- $("#info").append('<strong>Cuts:</strong> ' + data.jobMetaData.Cuts + '</br>');
- $("#info").append('<strong>Generator:</strong> ' + data.jobMetaData.Generator + '</br>');
- $("#info").append('<strong>Version:</strong> ' + data.jobMetaData.Version + '</br>');
- $("#info").append('<strong>Tune:</strong> ' + data.jobMetaData.Tune + '</br>');
- $("#info").append('<strong>Events:</strong> ' + data.jobMetaData.Events + '</br>');
+ // Check if there are some images to show, otherwise, keep the waiting message
+ if (data.sprites.histograms.length != 0) {
+ $("#waiting").hide();
+ $("#container").show();
+ // Output the jobMetaData
+ $("#info").append('<strong>Beam:</strong> ' + data.jobMetaData.Beam + '</br>');
+ $("#info").append('<strong>Process:</strong> ' + data.jobMetaData.Process + '</br>');
+ $("#info").append('<strong>Energy:</strong> ' + data.jobMetaData.Energy + '</br>');
+ $("#info").append('<strong>Cuts:</strong> ' + data.jobMetaData.Cuts + '</br>');
+ $("#info").append('<strong>Generator:</strong> ' + data.jobMetaData.Generator + '</br>');
+ $("#info").append('<strong>Version:</strong> ' + data.jobMetaData.Version + '</br>');
+ $("#info").append('<strong>Tune:</strong> ' + data.jobMetaData.Tune + '</br>');
+ $("#info").append('<strong>Events:</strong> ' + data.jobMetaData.Events + '</br>');
- // Retrieve histograms and append them to the figures
- // array
- $.each(data.sprites.histograms, function(index, histogram){
- figures.push({'image': "job" + histogram});
- });
- // Enable all the divs
- return figures;
+ // Retrieve histograms and append them to the figures
+ // array
+ $.each(data.sprites.histograms, function(index, histogram){
+ figures.push({'image': "job" + histogram});
+ });
+ // Enable all the divs
+ return figures;
+ }
});
}

0 comments on commit b654d94

Please sign in to comment.