12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- loadingBar = {
- status: null,
- show: function(status, errorText) {
- if (status==='error') {
-
- loadingBar.status = 'error';
-
- if (errorText) errorText = errorText.replace('<br>', '');
- if (!errorText) errorText = 'Whoops, it looks like something went wrong. Please reload the site and try again!';
-
- if (visible.controls()) lychee.header.addClass('error');
-
- lychee.loadingBar
- .removeClass('loading uploading error')
- .addClass(status)
- .html('<h1>Error: <span>' + errorText + '</span></h1>')
- .show()
- .css('height', '40px');
-
- clearTimeout(lychee.loadingBar.data('timeout'));
- lychee.loadingBar.data('timeout', setTimeout(function() { loadingBar.hide(true) }, 3000));
- return true;
- }
- if (loadingBar.status===null) {
-
- loadingBar.status = 'loading';
-
- clearTimeout(lychee.loadingBar.data('timeout'));
- lychee.loadingBar.data('timeout', setTimeout(function() {
-
- if (visible.controls()) lychee.header.addClass('loading');
-
- lychee.loadingBar
- .removeClass('loading uploading error')
- .addClass('loading')
- .show();
- }, 1000));
- return true;
- }
- },
- hide: function(force) {
- if ((loadingBar.status!=='error'&&loadingBar.status!==null)||force) {
-
- loadingBar.status = null;
-
- if (visible.controls()) lychee.header.removeClass('error loading');
-
- lychee.loadingBar
- .html('')
- .css('height', '3px');
-
- clearTimeout(lychee.loadingBar.data('timeout'));
- setTimeout(function() { lychee.loadingBar.hide() }, 300);
- }
- }
- };
|