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