mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fa72c0b466
commit
d6b29fe464
@ -1,7 +1,7 @@
|
|||||||
#=======================================================================
|
#=======================================================================
|
||||||
|
|
||||||
__version__ = '''0.0.01'''
|
__version__ = '''0.0.01'''
|
||||||
__sub_version__ = '''20130528215723'''
|
__sub_version__ = '''20130613200255'''
|
||||||
__copyright__ = '''(c) Alex A. Naanou 2011'''
|
__copyright__ = '''(c) Alex A. Naanou 2011'''
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ CONFIG = {
|
|||||||
'cache-image-name': '%(guid)s - %(name)s',
|
'cache-image-name': '%(guid)s - %(name)s',
|
||||||
|
|
||||||
# the rest of the paths will be relative to this...
|
# the rest of the paths will be relative to this...
|
||||||
'cache-dir': '.ImageGridCache',
|
'cache-dir': '.ImageGrid',
|
||||||
|
|
||||||
'images': 'images.json',
|
'images': 'images.json',
|
||||||
'data': 'data.json',
|
'data': 'data.json',
|
||||||
|
|||||||
23
ui/data.js
23
ui/data.js
@ -16,7 +16,8 @@ var LOAD_SCREENS = 6
|
|||||||
var DEFAULT_SCREEN_IMAGES = 4
|
var DEFAULT_SCREEN_IMAGES = 4
|
||||||
var MAX_SCREEN_IMAGES = 12
|
var MAX_SCREEN_IMAGES = 12
|
||||||
|
|
||||||
var CACHE_DIR = '.ImageGridCache'
|
var CACHE_DIR = '.ImageGrid'
|
||||||
|
var CACHE_DIR_VAR = '${CACHE_DIR}'
|
||||||
|
|
||||||
// A stub image, also here for documentation...
|
// A stub image, also here for documentation...
|
||||||
var STUB_IMAGE_DATA = {
|
var STUB_IMAGE_DATA = {
|
||||||
@ -434,6 +435,8 @@ function normalizePath(url, base, mode){
|
|||||||
//mode = /^\./.test(base) && mode == null ? 'relative' : null
|
//mode = /^\./.test(base) && mode == null ? 'relative' : null
|
||||||
mode = mode == null ? 'absolute' : mode
|
mode = mode == null ? 'absolute' : mode
|
||||||
|
|
||||||
|
res = ''
|
||||||
|
|
||||||
// windows path...
|
// windows path...
|
||||||
// - replace all '\\' with '/'...
|
// - replace all '\\' with '/'...
|
||||||
url = url.replace(/\\/g, '/')
|
url = url.replace(/\\/g, '/')
|
||||||
@ -447,25 +450,33 @@ function normalizePath(url, base, mode){
|
|||||||
// check if we start with base, and remove it if so...
|
// check if we start with base, and remove it if so...
|
||||||
if(mode == 'relative' && url.substring(0, base.length) == base){
|
if(mode == 'relative' && url.substring(0, base.length) == base){
|
||||||
url = url.substring(base.length - 1)
|
url = url.substring(base.length - 1)
|
||||||
return url[0] == '/' ? url.substring(1) : url
|
res = url[0] == '/' ? url.substring(1) : url
|
||||||
|
|
||||||
// if it's a different path, return as-is
|
// if it's a different path, return as-is
|
||||||
} else if(mode == 'absolute'){
|
} else if(mode == 'absolute'){
|
||||||
return url
|
res = url
|
||||||
}
|
}
|
||||||
|
|
||||||
// make an absolute path...
|
// make an absolute path...
|
||||||
} else if(mode == 'absolute') {
|
} else if(mode == 'absolute') {
|
||||||
// if base ends and url starts with '.' avoid making it a '..'
|
// if base ends and url starts with '.' avoid making it a '..'
|
||||||
if(base[base.length-1] == '.' && url[0] == '.'){
|
if(base[base.length-1] == '.' && url[0] == '.'){
|
||||||
return base + url.substring(1)
|
res = base + url.substring(1)
|
||||||
// avoid creating '//'...
|
// avoid creating '//'...
|
||||||
} else if(base[base.length-1] != '/' && url[0] != '/'){
|
} else if(base[base.length-1] != '/' && url[0] != '/'){
|
||||||
return base + '/' + url
|
res = base + '/' + url
|
||||||
} else {
|
} else {
|
||||||
return base + url
|
res = base + url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get the actual path...
|
||||||
|
res = res.replace('${CACHE_DIR}', CACHE_DIR)
|
||||||
|
|
||||||
|
// XXX legacy support...
|
||||||
|
res = res.replace('.ImageGridCache', CACHE_DIR)
|
||||||
|
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
ui/files.js
19
ui/files.js
@ -245,7 +245,7 @@ function loadFileImages(path, no_load_diffs){
|
|||||||
|
|
||||||
// default locations...
|
// default locations...
|
||||||
if(path == null){
|
if(path == null){
|
||||||
var base = normalizePath(CACHE_DIR)
|
var base = normalizePath(CACHE_DIR_VAR)
|
||||||
var loader = loadLatestFile(base,
|
var loader = loadLatestFile(base,
|
||||||
IMAGES_FILE_DEFAULT,
|
IMAGES_FILE_DEFAULT,
|
||||||
IMAGES_FILE_PATTERN,
|
IMAGES_FILE_PATTERN,
|
||||||
@ -253,7 +253,7 @@ function loadFileImages(path, no_load_diffs){
|
|||||||
|
|
||||||
// explicit base dir...
|
// explicit base dir...
|
||||||
} else if(!/\.json$/i.test(path)) {
|
} else if(!/\.json$/i.test(path)) {
|
||||||
var base = normalizePath(path +'/'+ CACHE_DIR)
|
var base = normalizePath(path +'/'+ CACHE_DIR_VAR)
|
||||||
var loader = loadLatestFile(base,
|
var loader = loadLatestFile(base,
|
||||||
IMAGES_FILE_DEFAULT,
|
IMAGES_FILE_DEFAULT,
|
||||||
IMAGES_FILE_PATTERN,
|
IMAGES_FILE_PATTERN,
|
||||||
@ -283,7 +283,7 @@ function loadFileImages(path, no_load_diffs){
|
|||||||
// NOTE: this will uses CACHE_DIR as the location if no name is given.
|
// NOTE: this will uses CACHE_DIR as the location if no name is given.
|
||||||
function saveFileImages(name){
|
function saveFileImages(name){
|
||||||
var remove_diffs = (name == null)
|
var remove_diffs = (name == null)
|
||||||
name = name == null ? normalizePath(CACHE_DIR +'/'+ Date.timeStamp()) : name
|
name = name == null ? normalizePath(CACHE_DIR_VAR +'/'+ Date.timeStamp()) : name
|
||||||
|
|
||||||
if(window.dumpJSON == null){
|
if(window.dumpJSON == null){
|
||||||
showErrorStatus('Can\'t save to file.')
|
showErrorStatus('Can\'t save to file.')
|
||||||
@ -292,11 +292,11 @@ function saveFileImages(name){
|
|||||||
|
|
||||||
// remove the diffs...
|
// remove the diffs...
|
||||||
if(remove_diffs){
|
if(remove_diffs){
|
||||||
$.each($.map(listDir(normalizePath(CACHE_DIR)), function(e){
|
$.each($.map(listDir(normalizePath(CACHE_DIR_VAR)), function(e){
|
||||||
return IMAGES_DIFF_FILE_PATTERN.test(e) ? e : null
|
return IMAGES_DIFF_FILE_PATTERN.test(e) ? e : null
|
||||||
}), function(i, e){
|
}), function(i, e){
|
||||||
showStatusQ('removeing:', e)
|
showStatusQ('removeing:', e)
|
||||||
removeFile(normalizePath(CACHE_DIR +'/'+ e))
|
removeFile(normalizePath(CACHE_DIR_VAR +'/'+ e))
|
||||||
})
|
})
|
||||||
IMAGES_UPDATED = []
|
IMAGES_UPDATED = []
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ function loadFileMarks(path){
|
|||||||
var res = $.Deferred()
|
var res = $.Deferred()
|
||||||
// default locations...
|
// default locations...
|
||||||
if(path == null){
|
if(path == null){
|
||||||
var base = normalizePath(CACHE_DIR)
|
var base = normalizePath(CACHE_DIR_VAR)
|
||||||
var loader = loadLatestFile(base,
|
var loader = loadLatestFile(base,
|
||||||
MARKED_FILE_DEFAULT,
|
MARKED_FILE_DEFAULT,
|
||||||
MARKED_FILE_PATTERN)
|
MARKED_FILE_PATTERN)
|
||||||
@ -322,7 +322,8 @@ function loadFileMarks(path){
|
|||||||
} else {
|
} else {
|
||||||
path = normalizePath(path)
|
path = normalizePath(path)
|
||||||
var base = path.split(CACHE_DIR)[0]
|
var base = path.split(CACHE_DIR)[0]
|
||||||
base += '/'+ CACHE_DIR
|
//base = normalizePath(path +'/'+ CACHE_DIR_VAR)
|
||||||
|
base = path +'/'+ CACHE_DIR
|
||||||
|
|
||||||
// XXX is this correct???
|
// XXX is this correct???
|
||||||
var loader = loadLatestFile(base,
|
var loader = loadLatestFile(base,
|
||||||
@ -342,7 +343,7 @@ function loadFileMarks(path){
|
|||||||
|
|
||||||
// Save image marks to file
|
// Save image marks to file
|
||||||
function saveFileMarks(name){
|
function saveFileMarks(name){
|
||||||
name = name == null ? normalizePath(CACHE_DIR +'/'+ Date.timeStamp()) : name
|
name = name == null ? normalizePath(CACHE_DIR_VAR +'/'+ Date.timeStamp()) : name
|
||||||
|
|
||||||
dumpJSON(name + '-marked.json', MARKED)
|
dumpJSON(name + '-marked.json', MARKED)
|
||||||
}
|
}
|
||||||
@ -424,7 +425,7 @@ function saveFileState(name, no_normalize_path){
|
|||||||
name = name == null ? Date.timeStamp() : name
|
name = name == null ? Date.timeStamp() : name
|
||||||
|
|
||||||
if(!no_normalize_path){
|
if(!no_normalize_path){
|
||||||
name = normalizePath(CACHE_DIR +'/'+ name)
|
name = normalizePath(CACHE_DIR_VAR +'/'+ name)
|
||||||
|
|
||||||
// write .image_file only if saving data to a non-cache dir...
|
// write .image_file only if saving data to a non-cache dir...
|
||||||
// XXX check if this is correct...
|
// XXX check if this is correct...
|
||||||
|
|||||||
@ -121,21 +121,30 @@ button:hover {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.ribbon-set:empty:before,
|
||||||
.ribbon-set:empty:after {
|
.ribbon-set:empty:after {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "No files loaded, press 'O' to load.";
|
content: "Nothing loaded...";
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
margin-top: -10px;
|
margin-top: -20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: center;
|
vertical-align: center;
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
color: silver;
|
color: silver;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
.ribbon-set:empty:after {
|
||||||
|
content: "Press 'O' to load, 'F1' for help or '?' for keyboard mappings.";
|
||||||
|
margin-top: 5px;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 16px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
/********************************************************** Ribbon ***/
|
/********************************************************** Ribbon ***/
|
||||||
.ribbon {
|
.ribbon {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -862,6 +871,7 @@ button:hover {
|
|||||||
.light.viewer .overlay-block:hover .background:after {
|
.light.viewer .overlay-block:hover .background:after {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
.light.viewer .ribbon-set:empty:before,
|
||||||
.light.viewer .ribbon-set:empty:after {
|
.light.viewer .ribbon-set:empty:after {
|
||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,24 +197,36 @@ button:hover {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.ribbon-set:empty:before,
|
||||||
.ribbon-set:empty:after {
|
.ribbon-set:empty:after {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "No files loaded, press 'O' to load.";
|
|
||||||
|
content: "Nothing loaded...";
|
||||||
|
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
margin-top: -10px;
|
margin-top: -20px;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: center;
|
vertical-align: center;
|
||||||
|
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
color: silver;
|
color: silver;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
.ribbon-set:empty:after {
|
||||||
|
|
||||||
|
content: "Press 'O' to load, 'F1' for help or '?' for keyboard mappings.";
|
||||||
|
|
||||||
|
margin-top: 5px;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 16px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -863,6 +875,7 @@ button:hover {
|
|||||||
.light.viewer .overlay-block:hover .background:after {
|
.light.viewer .overlay-block:hover .background:after {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
.light.viewer .ribbon-set:empty:before,
|
||||||
.light.viewer .ribbon-set:empty:after {
|
.light.viewer .ribbon-set:empty:after {
|
||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user