diff --git a/ui/Makefile b/ui/Makefile index eff9797f..551db819 100755 --- a/ui/Makefile +++ b/ui/Makefile @@ -97,6 +97,7 @@ zip: $(APP_ZIP) node-deps: npm install fs.extra + npm install exif dev: $(CSS_FILES) unzip -uj $(wildcard targets/node-webkit/node-webkit-*-win-ia32.zip) -d . diff --git a/ui/compatibility.js b/ui/compatibility.js index 69235818..dfd2f28c 100755 --- a/ui/compatibility.js +++ b/ui/compatibility.js @@ -28,6 +28,8 @@ if(window.CEF_dumpJSON != null){ var fs = require('fs') var fse = require('fs.extra') var proc = require('child_process') + var crypto = require('crypto') + //var exif = require('exif2') var gui = require('nw.gui') var fp = /file:\/\/\// @@ -282,6 +284,32 @@ if(window.CEF_dumpJSON != null){ return _PREVIW_CREATE_QUEUE } + // XXX should this be sync??? + // XXX we are cheating here right now... + /* + window.makeImageGID = function(path, make_text_gid){ + + // XXX get exif... + + var artist = + // format: "20130102-122315" + var date = + var name = path.split(/[\\\/]/).pop() + + var text_gid = artist +'-'+ date +'-'+ name + + if(make_text_gid){ + return text_gid + } + + var h = crypto.createHash('sha1') + h.update(text_gid) + var hex_gid = h.digest('hex') + + return hex_gid + } + */ + // UI-specific... window.toggleFullscreenMode = createCSSClassToggler( document.body, diff --git a/ui/lib/jli.js b/ui/lib/jli.js index d64ba8e0..9d691bf1 100755 --- a/ui/lib/jli.js +++ b/ui/lib/jli.js @@ -616,10 +616,12 @@ Date.prototype.toShortDate = function(){ H = H < 10 ? '0'+H : H var m = this.getMinutes() m = m < 10 ? '0'+m : m + var s = this.getSeconds() + s = s < 10 ? '0'+s : s - return ''+y+'-'+M+'-'+D+' '+H+':'+m + return ''+y+'-'+M+'-'+D+' '+H+':'+m+':'+s } -Date.prototype.getTimeStamp = function(){ +Date.prototype.getTimeStamp = function(no_seconds){ var y = this.getFullYear() var M = this.getMonth()+1 M = M < 10 ? '0'+M : M @@ -629,8 +631,10 @@ Date.prototype.getTimeStamp = function(){ H = H < 10 ? '0'+H : H var m = this.getMinutes() m = m < 10 ? '0'+m : m + var s = this.getSeconds() + s = s < 10 ? '0'+s : s - return ''+y+M+D+H+m + return ''+y+M+D+H+m+s } Date.prototype.setTimeStamp = function(ts){ this.setFullYear(ts.slice(0, 4)) @@ -638,6 +642,7 @@ Date.prototype.setTimeStamp = function(ts){ this.setDate(ts.slice(6, 8)) this.setHours(ts.slice(8, 10)) this.setMinutes(ts.slice(10, 12)) + this.setSeconds(ts.slice(12, 14)) return this } Date.timeStamp = function(){ diff --git a/ui/ui.js b/ui/ui.js index b33f85f1..04595003 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -379,6 +379,8 @@ function hideOverlay(root){ var FIELD_TYPES = { + // format: + // string text: { type: 'text', text: null, @@ -397,6 +399,9 @@ var FIELD_TYPES = { return $(field).find('.value').attr('value') }, }, + + // format: + // true | false bool: { type: 'bool', text: null, @@ -421,6 +426,8 @@ var FIELD_TYPES = { }, // NOTE: this will not work without node-webkit... + // format: + // { dir: } dir: { type: 'dir', text: null, @@ -429,7 +436,6 @@ var FIELD_TYPES = { ''+ ''+ '', - // format: {dir: } test: function(val){ return typeof(val) == typeof({}) && 'dir' in val }, @@ -444,7 +450,10 @@ var FIELD_TYPES = { return f[0].path }, }, + // NOTE: this will not work without node-webkit... + // format: + // { dir: } ndir: { type: 'ndir', text: null, @@ -454,7 +463,6 @@ var FIELD_TYPES = { ''+ ''+ '', - // format: {dir: } test: function(val){ return typeof(val) == typeof({}) && 'ndir' in val }, @@ -491,6 +499,8 @@ var FIELD_TYPES = { }, }, + // format: + // ['a', 'b', 'c', ...] choice: { type: 'choice', text: null, @@ -502,7 +512,6 @@ var FIELD_TYPES = { ''+ ''+ '', - // format: ['a', 'b', 'c', ...] test: function(val){ return typeof(val) == typeof([]) && val.constructor.name == 'Array' }, @@ -528,6 +537,40 @@ var FIELD_TYPES = { return $(field).find('.value:checked').val() }, }, + + // NOTE: a button can have state... + // format: + // { + // // click event handler... + // button: , + // // optional, button text (default 'OK')... + // text: , + // // optional, initial state setup... + // default: , + // } + button: { + type: 'button', + text: null, + default: false, + html: '
'+ + ''+ + ''+ + '
', + test: function(val){ + return 'button' in val + }, + set: function(field, value){ + var btn = $(field).find('button') + .click(value.button) + .html(value.text == null ? 'OK' : value.text) + if('default' in value){ + value.default(btn) + } + }, + get: function(field){ + return $(field).attr('state') + }, + }, } // Show a complex form dialog