ImageGrid/legacy/ui/formats.js
Alex A. Naanou 5f47d6da7b restructured the repo moving the legacy out of the way...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2020-08-28 17:32:02 +03:00

64 lines
1.3 KiB
JavaScript
Executable File

/**********************************************************************
*
*
*
**********************************************************************/
//var DEBUG = DEBUG != null ? DEBUG : true
/*********************************************************************/
// Convert legacy Gen1 data format to current Gen3 (v2.0+)
function convertDataGen1(data, cmp){
var res = {
data: {
version: DATA_VERSION,
current: null,
ribbons: [],
order: [],
},
images: {}
}
cmp = cmp == null ?
function(a, b){
return imageDateCmp(a, b, null, res.images)
}
: cmp
var ribbons = res.data.ribbons
var order = res.data.order
var images = res.images
// position...
res.data.current = data.position
// ribbons and images...
$.each(data.ribbons, function(i, input_images){
var ribbon = []
ribbons.push(ribbon)
for(var id in input_images){
var image = input_images[id]
ribbon.push(id)
order.push(id)
images[id] = image
}
ribbon.sort(cmp)
})
order.sort(cmp)
// XXX STUB
res.data.current = order[0]
return res
}
/**********************************************************************
* vim:set ts=4 sw=4 : */