corrade-nucleus-nucleons – Diff between revs 31 and 33
?pathlinks?
Rev 31 | Rev 33 | |||
---|---|---|---|---|
Line 38... | Line 38... | |||
38 | // Disable button for successive clicks. |
38 | // Disable button for successive clicks. |
|
39 | $('#' + nucleon + '-window-manager-button').prop('disabled', true); |
39 | $('#' + nucleon + '-window-manager-button').prop('disabled', true); |
|
Line 40... | Line 40... | |||
40 | |
40 | |
|
41 | // Load the nucleon. |
41 | // Load the nucleon. |
|
- | 42 | $.get('/' + nucleon + '/index.html', function(data) { |
||
- | 43 | // Select all new scripts that have to be inserted into the DOM. |
||
- | 44 | var nucleonScripts = []; |
||
- | 45 | $(data).find('script').each(function() { |
||
- | 46 | var src = $(this).attr('src'); |
||
- | 47 | if(src === undefined) |
||
- | 48 | return; |
||
- | 49 | nucleonScripts[src] = $(this).get(0); |
||
- | 50 | }); |
||
- | 51 | // Remove scripts from the nucleon if they are already added to the DOM. |
||
- | 52 | var nowScripts = $(document).find('script').each(function() { |
||
- | 53 | var src = $(this).attr('src'); |
||
- | 54 | if(nucleonScripts[src] === undefined) |
||
- | 55 | return; |
||
- | 56 | $(data).remove(nucleonScripts[src]); |
||
42 | $.get('/' + nucleon + '/index.html', function(data) { |
57 | }); |
|
43 | $(data).hide().appendTo('#window-manager-desktop').fadeIn(750); |
58 | $(data).hide().appendTo('#window-manager-desktop').fadeIn(750); |
|
44 | }).done(function(data) { |
59 | }).done(function(data) { |
|
45 | // Change the nucleon icon back. |
60 | // Change the nucleon icon back. |
|
46 | $('#' + nucleon + '-window-manager-button-icon').attr('src', '/' + nucleon + '/img/' + nucleon + '.png'); |
61 | $('#' + nucleon + '-window-manager-button-icon').attr('src', '/' + nucleon + '/img/' + nucleon + '.png'); |