lychee/assets/js/modules/loadingBar.js
Tobias Reich dd2f6ebc77 V2.0
- All new redefined interface
- Faster animations and transitions
- Import from Dropbox
- Import from Server
- Download public albums
- Several sorting options
- Installation assistent
- Infobox and description for albums
- Faster loading and improved performance
- Better file handling and upload
- Album covers are chosen intelligent
- Prettier URLs
- Massive changes under the hood
- IPTC support (Headline and Caption)
- EXIF Orientation support

How to update:
1. Replace all files, excluding `uploads/`
2. Open Lychee and enter your database details
2014-01-22 11:12:51 +01:00

62 lines
1.5 KiB
JavaScript
Executable File

/**
* @name LoadingBar Module
* @description This module is used to show and hide the loading bar.
* @author Tobias Reich
* @copyright 2014 by Tobias Reich
*/
loadingBar = {
status: null,
show: function(status, errorText) {
if (status==="error") {
loadingBar.status = "error";
if (!errorText) errorText = "Whoops, it looks like something went wrong. Please reload the site and try again!"
lychee.loadingBar
.removeClass("loading uploading error")
.addClass(status)
.html("<h1>Error: <span>" + errorText + "</span></h1>")
.show()
.css("height", "40px");
if (visible.controls()) lychee.header.addClass("error");
clearTimeout(lychee.loadingBar.data("timeout"));
lychee.loadingBar.data("timeout", setTimeout(function() { loadingBar.hide(true) }, 3000));
} else if (loadingBar.status==null) {
loadingBar.status = "loading";
clearTimeout(lychee.loadingBar.data("timeout"));
lychee.loadingBar.data("timeout", setTimeout(function() {
lychee.loadingBar
.show()
.removeClass("loading uploading error")
.addClass("loading");
if (visible.controls()) lychee.header.addClass("loading");
}, 1000));
}
},
hide: function(force_hide) {
if ((loadingBar.status!=="error"&&loadingBar.status!=null)||force_hide) {
loadingBar.status = null;
clearTimeout(lychee.loadingBar.data("timeout"));
lychee.loadingBar.html("").css("height", "3px");
if (visible.controls()) lychee.header.removeClass("error loading");
setTimeout(function() { lychee.loadingBar.hide() }, 300);
}
}
}