mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
updated todo, added general manupulation functions: reverseRibbons, sortImages, reverseImageOrder and helpers: jQuery.fn.reverseChildren and jQuery.fn.sortChildren...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
533c13faff
commit
db736cea92
21
ui/TODO.otl
21
ui/TODO.otl
@ -198,6 +198,27 @@ Priority work
|
|||||||
[_] 0% 1.0
|
[_] 0% 1.0
|
||||||
|
|
||||||
|
|
||||||
|
[_] 33% Main workflow
|
||||||
|
[_] 33% image viewing
|
||||||
|
[X] viewer
|
||||||
|
[_] select source
|
||||||
|
[_] slideshow
|
||||||
|
[X] 100% ribbon sorting
|
||||||
|
[X] ribbon navigation
|
||||||
|
[X] shift image between ribbons
|
||||||
|
[_] 0% metadata
|
||||||
|
[_] tag filtering
|
||||||
|
[_] tag editing
|
||||||
|
[_] EXIF/IPTC
|
||||||
|
[_] 0% image/export export
|
||||||
|
[_] JSON
|
||||||
|
[_] XMP metadata
|
||||||
|
[_] fav dirs
|
||||||
|
[_] file list
|
||||||
|
[_] image set
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Goals:
|
Goals:
|
||||||
main ribbon always consistent
|
main ribbon always consistent
|
||||||
fast sorting via several simple passes
|
fast sorting via several simple passes
|
||||||
|
|||||||
@ -15,7 +15,8 @@ var BACKGROUND_MODES = [
|
|||||||
// ...this effectively makes the modes independant...
|
// ...this effectively makes the modes independant...
|
||||||
// NOTE: null represent the default value (no class set)...
|
// NOTE: null represent the default value (no class set)...
|
||||||
// NOTE: these will change if changed in runtime...
|
// NOTE: these will change if changed in runtime...
|
||||||
var NORMAL_MODE_BG = 'dark'
|
//var NORMAL_MODE_BG = 'dark'
|
||||||
|
var NORMAL_MODE_BG = null
|
||||||
var SINGLE_IMAGE_MODE_BG = 'black'
|
var SINGLE_IMAGE_MODE_BG = 'black'
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +41,21 @@ var MOVE_DELTA = 50
|
|||||||
/********************************************************** Helpers **/
|
/********************************************************** Helpers **/
|
||||||
|
|
||||||
|
|
||||||
|
jQuery.fn.reverseChildren = function(){
|
||||||
|
return $(this).each(function(_, e){
|
||||||
|
return $(e).append($(e).children().detach().get().reverse())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
jQuery.fn.sortChildren = function(func){
|
||||||
|
return $(this).each(function(_, e){
|
||||||
|
return $(e).append($(e).children().detach().get().sort(func))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getImageOrder(img){
|
function getImageOrder(img){
|
||||||
// XXX HACK need to parseInt this because '13' is less than '2'...
|
// XXX HACK need to parseInt this because '13' is less than '2'...
|
||||||
// ...figure a way out of this!!!
|
// ...figure a way out of this!!!
|
||||||
@ -50,6 +66,12 @@ function setImageOrder(img, order){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function cmpImageOrder(a, b){
|
||||||
|
return getImageOrder(a) - getImageOrder(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this will create a function that will add/remove a css_class to elem
|
// this will create a function that will add/remove a css_class to elem
|
||||||
// calling the optional callbacks before and/or after.
|
// calling the optional callbacks before and/or after.
|
||||||
@ -1001,6 +1023,7 @@ function createRibbon(direction){
|
|||||||
// XXX this uses jquery animation...
|
// XXX this uses jquery animation...
|
||||||
// XXX one way to optimise this is to add the lesser ribbon to the
|
// XXX one way to optimise this is to add the lesser ribbon to the
|
||||||
// greater disregarding their actual order...
|
// greater disregarding their actual order...
|
||||||
|
// XXX think about using $(...).sortChildren(...) / sortImages()
|
||||||
function mergeRibbons(direction, get_order){
|
function mergeRibbons(direction, get_order){
|
||||||
if(get_order == null){
|
if(get_order == null){
|
||||||
get_order = getImageOrder
|
get_order = getImageOrder
|
||||||
@ -1079,6 +1102,46 @@ var shiftImageUp = function(){ return shiftImage('prev') }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// reverse the ribbon order...
|
||||||
|
function reverseRibbons(){
|
||||||
|
var ribbons = $('.ribbon')
|
||||||
|
var field = $('.field')
|
||||||
|
var scale = getElementScale(field)
|
||||||
|
// get current ribbon index...
|
||||||
|
var cur = ribbons.index($('.current.ribbon'))
|
||||||
|
|
||||||
|
// reverse...
|
||||||
|
field.reverseChildren()
|
||||||
|
|
||||||
|
// compensate for offset cange...
|
||||||
|
$('.current.image').click()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// sort all images in all ribbons...
|
||||||
|
// NOTE: this will only align three ribbons...
|
||||||
|
function sortImages(){
|
||||||
|
$('.ribbon').sortChildren(cmpImageOrder)
|
||||||
|
|
||||||
|
// compensate for offset cange...
|
||||||
|
$('.current.image').click()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// this will reverse the order of images in all ribbons by reversing
|
||||||
|
// id attr and resorting...
|
||||||
|
function reverseImageOrder(){
|
||||||
|
// reverse ID order...
|
||||||
|
$($('.image').get().sort(cmpImageOrder).reverse())
|
||||||
|
.each(function(i, e){$(e).attr({'id': i})})
|
||||||
|
// resort the images...
|
||||||
|
sortImages()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
// vim:set ts=4 sw=4 nowrap :
|
// vim:set ts=4 sw=4 nowrap :
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user