update.js 1.1 KB

1234567891011121314151617181920212223
  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. });
  9. updateEventSource.listen('failure', function(message) {
  10. $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
  11. $('<span>')
  12. .addClass('error bold')
  13. .append('<br />')
  14. .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>.'))
  15. .appendTo($('.update'));
  16. });
  17. updateEventSource.listen('done', function(message) {
  18. $('<span>').addClass('bold').append('<br />').append(t('core', 'The update was successful. Redirecting you to ownCloud now.')).appendTo($('.update'));
  19. setTimeout(function () {
  20. window.location.href = OC.webroot;
  21. }, 3000);
  22. });
  23. });