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