corrade-nucleus-nucleons

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 25  →  ?path2? @ 28
/base/000_base/js/nucleus/load-nucleons.js
@@ -1,3 +1,26 @@
function loadNucleon(nucleon) {
// If the nucleon already exists, then do not append the content again.
if($('#' + nucleon).length)
return;
// Disable button for successive clicks.
$('#' + nucleon + '-button').prop('disabled', true);
// Change the nucleon icon to a loading icon.
$('#' + nucleon + '-icon').attr('src', '/img/loader.svg');
// Load the nucleon.
$.get('/' + nucleon + '/index.html', function(data) {
$('#nucleons-container').append(data);
}).done(function(data) {
// Change the nucleon icon back.
$('#' + nucleon + '-icon').attr('src', '/' + nucleon + '/img/' + nucleon + '.png');
// Enable the button.
$('#' + nucleon + '-button').prop('disabled', false);
});
}
 
// Generate the nucleon selectors.
$(document).ready(function() {
// Search and load all nucleons.
$.get('/nucleons', function(data) {