mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e5127b85bc
commit
187e538bb9
17
ui/data.js
17
ui/data.js
@ -427,6 +427,23 @@ function cmp(a, b, get){
|
||||
}
|
||||
|
||||
|
||||
// Generate a cmp function that will use all the cmp's in cmp_chain in
|
||||
// sequence if the previous returns 0 (equal).
|
||||
//
|
||||
function chainCmp(cmp_chain){
|
||||
return function(a, b, get, data){
|
||||
var res
|
||||
for(var i=0; i < cmp_chain.length; i++){
|
||||
res = cmp_chain[i](a, b, get, data)
|
||||
if(res != 0){
|
||||
return res
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Generic image ordering comparison via DATA.order
|
||||
//
|
||||
// NOTE: see updateRibbonORder(...) for a general view on image sorting
|
||||
|
||||
17
ui/sort.js
17
ui/sort.js
@ -159,23 +159,6 @@ function imageXPStyleFileNameCmp(a, b, get, data){
|
||||
}
|
||||
|
||||
|
||||
// Generate a cmp function that will use all the cmp's in cmp_chain in
|
||||
// sequence if the previous returns 0 (equal).
|
||||
//
|
||||
function chainCmp(cmp_chain){
|
||||
return function(a, b, get, data){
|
||||
var res
|
||||
for(var i=0; i < cmp_chain.length; i++){
|
||||
res = cmp_chain[i](a, b, get, data)
|
||||
if(res != 0){
|
||||
return res
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sort action generator...
|
||||
//
|
||||
function sortVia(cmp){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user