diff options
Diffstat (limited to 'misc/update.js')
-rw-r--r-- | misc/update.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/misc/update.js b/misc/update.js index 9177296a1..46272f6ef 100644 --- a/misc/update.js +++ b/misc/update.js @@ -1,12 +1,11 @@ // $Id$ -if (isJsEnabled()) { - addLoadEvent(function() { - if ($('edit-has_js')) { - $('edit-has_js').value = 1; - } +if (Drupal.jsEnabled) { + $(document).ready(function() { + $('#edit-has_js').each(function() { this.value = 1; }); + $('#progress').each(function () { + var holder = this; - if ($('progress')) { // Success: redirect to the summary. var updateCallback = function (progress, status, pb) { if (progress == 100) { @@ -19,15 +18,15 @@ if (isJsEnabled()) { var errorCallback = function (pb) { var div = document.createElement('p'); div.className = 'error'; - div.innerHTML = 'An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>'; - $('progress').insertBefore(div, $('progress').firstChild); - $('wait').style.display = 'none'; + $(div).html('An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>'); + $(holder).prepend(div); + $('#wait').hide(); } - var progress = new progressBar('updateprogress', updateCallback, HTTPPost, errorCallback); + var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback); progress.setProgress(-1, 'Starting updates'); - $('progress').appendChild(progress.element); + $(holder).append(progress.element); progress.startMonitoring('update.php?op=do_update', 0); - } + }); }); } |