mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-24 20:11:56 +00:00
relative paths appear to be working...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cc1d88771e
commit
c286950508
11
ui/data.js
11
ui/data.js
@ -17,6 +17,8 @@ var MAX_SCREEN_IMAGES = 12
|
|||||||
// title attr.
|
// title attr.
|
||||||
var IMAGE_TITLE_DATA = true
|
var IMAGE_TITLE_DATA = true
|
||||||
|
|
||||||
|
var CACHE_DIR = '.ImageGridCache'
|
||||||
|
|
||||||
// A stub image, also here for documentation...
|
// A stub image, also here for documentation...
|
||||||
var STUB_IMAGE_DATA = {
|
var STUB_IMAGE_DATA = {
|
||||||
id: 'SIZE',
|
id: 'SIZE',
|
||||||
@ -374,7 +376,7 @@ function updateImage(image, gid, size){
|
|||||||
var preview = getBestPreview(gid, size)
|
var preview = getBestPreview(gid, size)
|
||||||
image
|
image
|
||||||
.css({
|
.css({
|
||||||
'background-image': 'url('+ preview.url +')',
|
'background-image': 'url("'+ preview.url +'")',
|
||||||
})
|
})
|
||||||
.attr({
|
.attr({
|
||||||
order: DATA.order.indexOf(gid),
|
order: DATA.order.indexOf(gid),
|
||||||
@ -751,9 +753,12 @@ function loadFileImages(path, callback){
|
|||||||
|
|
||||||
// XXX add relative path support (via. normalizePath(...))
|
// XXX add relative path support (via. normalizePath(...))
|
||||||
function loadFile(data_path, image_path, callback){
|
function loadFile(data_path, image_path, callback){
|
||||||
|
var base = data_path.split(CACHE_DIR)[0]
|
||||||
|
base = base == data_path ? '.' : base
|
||||||
// CEF
|
// CEF
|
||||||
return $.getJSON(data_path)
|
return $.getJSON(data_path)
|
||||||
.done(function(json){
|
.done(function(json){
|
||||||
|
BASE_URL = base
|
||||||
// legacy format...
|
// legacy format...
|
||||||
if(json.version == null){
|
if(json.version == null){
|
||||||
json = convertDataGen1(json)
|
json = convertDataGen1(json)
|
||||||
@ -768,14 +773,14 @@ function loadFile(data_path, image_path, callback){
|
|||||||
} else if(json.version == '2.0') {
|
} else if(json.version == '2.0') {
|
||||||
DATA = json
|
DATA = json
|
||||||
if(image_path != null){
|
if(image_path != null){
|
||||||
loadFileImages(image_path)
|
loadFileImages(normalizePath(image_path, base))
|
||||||
.done(function(){
|
.done(function(){
|
||||||
loadData()
|
loadData()
|
||||||
|
|
||||||
callback != null && callback()
|
callback != null && callback()
|
||||||
})
|
})
|
||||||
} else if(DATA.image_file != null) {
|
} else if(DATA.image_file != null) {
|
||||||
loadFileImages(DATA.image_file)
|
loadFileImages(normalizePath(DATA.image_file, base))
|
||||||
.done(function(){
|
.done(function(){
|
||||||
loadData()
|
loadData()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user