update.js 1.2 KB

123456789101112131415161718192021222324252627
  1. $(document).ready(function () {
  2. var updateEventSource = new OC.EventSource(OC.webroot+'/core/ajax/update.php');
  3. updateEventSource.listen('success', function(message) {
  4. $('<span>').append(message).append('<br />').appendTo($('.update'));
  5. });
  6. updateEventSource.listen('error', function(message) {
  7. $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
  8. message = t('core', 'Please reload the page.');
  9. $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
  10. updateEventSource.close();
  11. });
  12. updateEventSource.listen('failure', function(message) {
  13. $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
  14. $('<span>')
  15. .addClass('error bold')
  16. .append('<br />')
  17. .append(t('core', 'The update was unsuccessful. Please report this issue to the <a href="https://github.com/owncloud/core/issues" target="_blank">ownCloud community</a>.'))
  18. .appendTo($('.update'));
  19. });
  20. updateEventSource.listen('done', function(message) {
  21. $('<span>').addClass('bold').append('<br />').append(t('core', 'The update was successful. Redirecting you to ownCloud now.')).appendTo($('.update'));
  22. setTimeout(function () {
  23. window.location.href = OC.webroot;
  24. }, 3000);
  25. });
  26. });