$(document).ready(function () { var updateEventSource = new OC.EventSource(OC.webroot+'/core/ajax/update.php'); updateEventSource.listen('success', function(message) { $('').append(message).append('
').appendTo($('.update')); }); updateEventSource.listen('error', function(message) { $('').addClass('error').append(message).append('
').appendTo($('.update')); message = t('core', 'Please reload the page.'); $('').addClass('error').append(message).append('
').appendTo($('.update')); updateEventSource.close(); }); updateEventSource.listen('failure', function(message) { $('').addClass('error').append(message).append('
').appendTo($('.update')); $('') .addClass('error bold') .append('
') .append(t('core', 'The update was unsuccessful. Please report this issue to the ownCloud community.')) .appendTo($('.update')); }); updateEventSource.listen('done', function(message) { $('').addClass('bold').append('
').append(t('core', 'The update was successful. Redirecting you to ownCloud now.')).appendTo($('.update')); setTimeout(function () { window.location.href = OC.webroot; }, 3000); }); });