corrade-nucleus-nucleons – Diff between revs 28 and 30
?pathlinks?
Rev 28 | Rev 30 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | function loadNucleon(nucleon) { |
1 | function loadNucleon(nucleon) { |
|
2 | // If the nucleon already exists, then do not append the content again. |
2 | // If the nucleon already exists, then do not append the content again. |
|
3 | if($('#' + nucleon).length) |
3 | if($('#' + nucleon).length) |
|
4 | return; |
4 | return; |
|
Line -... | Line 5... | |||
- | 5 | |
||
- | 6 | // Change the nucleon icon to a loading icon. |
||
- | 7 | $('#' + nucleon + '-button-icon').attr('src', '/img/loader.gif'); |
||
5 | |
8 | |
|
6 | // Disable button for successive clicks. |
9 | // Disable button for successive clicks. |
|
Line 7... | Line -... | |||
7 | $('#' + nucleon + '-button').prop('disabled', true); |
- | ||
8 | |
- | ||
9 | // Change the nucleon icon to a loading icon. |
- | ||
10 | $('#' + nucleon + '-icon').attr('src', '/img/loader.svg'); |
10 | $('#' + nucleon + '-button').prop('disabled', true); |
|
11 | |
11 | |
|
12 | // Load the nucleon. |
12 | // Load the nucleon. |
|
13 | $.get('/' + nucleon + '/index.html', function(data) { |
13 | $.get('/' + nucleon + '/index.html', function(data) { |
|
14 | $('#nucleons-container').append(data); |
14 | $('#window-manager-desktop').append(data); |
|
15 | }).done(function(data) { |
15 | }).done(function(data) { |
|
16 | // Change the nucleon icon back. |
16 | // Change the nucleon icon back. |
|
17 | $('#' + nucleon + '-icon').attr('src', '/' + nucleon + '/img/' + nucleon + '.png'); |
17 | $('#' + nucleon + '-button-icon').attr('src', '/' + nucleon + '/img/' + nucleon + '.png'); |
|
18 | // Enable the button. |
18 | // Enable the button. |
|
19 | $('#' + nucleon + '-button').prop('disabled', false); |
19 | $('#' + nucleon + '-button').prop('disabled', false); |
|
Line 20... | Line 20... | |||
20 | }); |
20 | }); |
|
21 | } |
21 | } |
|
22 | |
22 | |
|
23 | // Generate the nucleon selectors. |
23 | // Generate the nucleon icons on the desktop. |
|
24 | $(document).ready(function() { |
24 | $(document).ready(function() { |
|
25 | // Search and load all nucleons. |
25 | // Search and load all nucleons. |
|
26 | $.get('/nucleons', function(data) { |
26 | $.get('/nucleons', function(data) { |
|
27 | var nucleons = wasCSVToArray(data); |
27 | var nucleons = wasCSVToArray(data); |
|
28 | $.each(nucleons, function(index, value) { |
28 | $.each(nucleons, function(index, value) { |
|
29 | // Skip files starting with full stop (POSIX). |
29 | // Skip files starting with full stop (POSIX). |
|
30 | if (/^\./.test(value)) return; |
30 | if (/^\./.test(value)) return; |
|
31 | $.get('/nucleons/' + value, function(doc) { |
31 | $.get('/nucleons/' + value, function(doc) { |
|
32 | var div = $('<div class="col-xs-6 col-md-3">').html(doc); |
32 | //var div = $('<div class="col-xs-6 col-md-3">').html(doc); |
|
33 | $('#nucleons').append(div); |
33 | $('#window-manager-desktop').append(doc); |
|
34 | }); |
34 | }); |