MDL-32654 Improve course javascript status spinner

This commit is contained in:
Andrew Robert Nicols
2012-05-08 09:12:15 +01:00
parent e16e2300c5
commit 45b364b92c
4 changed files with 58 additions and 53 deletions
+25
View File
@@ -833,6 +833,31 @@ M.util.add_lightbox = function(Y, node) {
return lightbox;
}
/**
* Appends a hidden spinner element to the specified node.
*
* @param {YUI} Y
* @param {Node} the node the spinner should be added to
* @return {Node} created spinner node
*/
M.util.add_spinner = function(Y, node) {
var WAITICON = {'pix':"i/loading_small",'component':'moodle'};
// Check if spinner is already there
if (node.one('.spinner')) {
return node.one('.spinner');
}
var spinner = Y.Node.create('<img />')
.setAttribute('src', M.util.image_url(WAITICON.pix, WAITICON.component))
.addClass('spinner')
.addClass('iconsmall')
.hide();
node.append(spinner);
return spinner;
}
//=== old legacy JS code, hopefully to be replaced soon by M.xx.yy and YUI3 code ===
function checkall() {