mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-19 01:31:38 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
da3ab5b996
commit
5737fbdd3d
62
ui/base.js
62
ui/base.js
@ -291,14 +291,14 @@ function shiftImage(direction, image, force_create_ribbon){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update an info element
|
||||||
|
//
|
||||||
// align can be:
|
// align can be:
|
||||||
// - top
|
// - top
|
||||||
// - bottom
|
// - bottom
|
||||||
//
|
//
|
||||||
// If target is an existing info container (class: overlay-info) then
|
// If target is an existing info container (class: overlay-info) then
|
||||||
// just fill that.
|
// just fill that.
|
||||||
//
|
|
||||||
// XXX revise...
|
|
||||||
function updateInfo(elem, data, target){
|
function updateInfo(elem, data, target){
|
||||||
var viewer = $('.viewer')
|
var viewer = $('.viewer')
|
||||||
target = target == null ? viewer : $(target)
|
target = target == null ? viewer : $(target)
|
||||||
@ -332,6 +332,64 @@ function hideInfo(elem){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update status message
|
||||||
|
//
|
||||||
|
// NOTE: this will update message content and return it as-is, things
|
||||||
|
// like showing the message are to be done manually...
|
||||||
|
// see: showStatus(...) and showErrorStatus(...) for a higher level
|
||||||
|
// API...
|
||||||
|
// NOTE: in addition to showing user status, this will also log the
|
||||||
|
// satus to browser console...
|
||||||
|
// NOTE: the message will be logged to console via either console.log(...)
|
||||||
|
// or console.error(...), if the message starts with "Error".
|
||||||
|
// NOTE: if message is null, then just return the status element...
|
||||||
|
//
|
||||||
|
// XXX add abbility to append and clear status...
|
||||||
|
function updateStatus(message){
|
||||||
|
|
||||||
|
var elem = $('.global-status')
|
||||||
|
if(elem.length == 0){
|
||||||
|
elem = $('<div class="global-status"/>')
|
||||||
|
}
|
||||||
|
if(message == null){
|
||||||
|
return elem
|
||||||
|
}
|
||||||
|
|
||||||
|
if(arguments.length > 1){
|
||||||
|
message = Array.apply(Array, arguments).join(' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof(message) == typeof('s') && /^error.*/i.test(message)){
|
||||||
|
console.error.apply(console, arguments)
|
||||||
|
} else {
|
||||||
|
console.log.apply(console, arguments)
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateInfo(elem, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Same as updateInfo(...) but will aslo show and animate-close the message
|
||||||
|
function showStatus(message){
|
||||||
|
return updateStatus(message)
|
||||||
|
.stop()
|
||||||
|
.show()
|
||||||
|
.delay(500)
|
||||||
|
.fadeOut(800)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Same as showStatus(...) but will always add 'Error: ' to the start
|
||||||
|
// of the message
|
||||||
|
//
|
||||||
|
// NOTE: this will show the message but will not hide it.
|
||||||
|
function showErrorStatus(message){
|
||||||
|
return updateStatus('Error:' + message)
|
||||||
|
.stop()
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Constructors
|
* Constructors
|
||||||
|
|||||||
37
ui/data.js
37
ui/data.js
@ -1202,43 +1202,6 @@ function openImage(){
|
|||||||
* Info & status...
|
* Info & status...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// NOTE: if message is null, then just return the status element...
|
|
||||||
function updateStatus(message){
|
|
||||||
|
|
||||||
var elem = $('.global-status')
|
|
||||||
if(elem.length == 0){
|
|
||||||
elem = $('<div class="global-status"/>')
|
|
||||||
}
|
|
||||||
if(message == null){
|
|
||||||
return elem
|
|
||||||
}
|
|
||||||
|
|
||||||
if(arguments.length > 1){
|
|
||||||
message = Array.apply(Array, arguments).join(' ')
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof(message) == typeof('s') && /^error.*/i.test(message)){
|
|
||||||
console.error.apply(console, arguments)
|
|
||||||
} else {
|
|
||||||
console.log.apply(console, arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
return updateInfo(elem, message)
|
|
||||||
}
|
|
||||||
function showStatus(message){
|
|
||||||
return updateStatus(message)
|
|
||||||
.stop()
|
|
||||||
.show()
|
|
||||||
.delay(500)
|
|
||||||
.fadeOut(800)
|
|
||||||
}
|
|
||||||
function showErrorStatus(message){
|
|
||||||
return updateStatus('Error:' + message)
|
|
||||||
.stop()
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// XXX do we need a full rewrite here, or will it be better to just fill
|
// XXX do we need a full rewrite here, or will it be better to just fill
|
||||||
// the slots...
|
// the slots...
|
||||||
function updateGlobalImageInfo(image){
|
function updateGlobalImageInfo(image){
|
||||||
|
|||||||
@ -518,6 +518,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.global-status {
|
.global-status {
|
||||||
|
display: block;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user