diff --git a/ui (gen4)/index.html b/ui (gen4)/index.html
index 6363eae5..56c23240 100755
--- a/ui (gen4)/index.html
+++ b/ui (gen4)/index.html
@@ -78,6 +78,15 @@
transition: none;
}
+/* XXX think of a way not to use !important */
+.viewer.single-image-mode .ribbon {
+ -webkit-transition: none !important;
+ -moz-transition: none !important;
+ -ms-transition: none !important;
+ -o-transition: none !important;
+ transition: none !important;
+}
+
/* DEBUG stuff... */
.container-center {
diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js
index 47c786e7..c0c3d38d 100755
--- a/ui (gen4)/lib/actions.js
+++ b/ui (gen4)/lib/actions.js
@@ -157,6 +157,9 @@ if(typeof(args2array) != 'function'){
// registered from the current object and up to the base action set
// will be fired.
//
+// - an action will return the last deepest action's return, if that
+// return is null, then the action set is returned.
+//
// NOTE: actions once defined do not depend on the inheritance hierarchy,
// other than the .getHandlers(..) method. If this method is not
// found in the inheritance chain (i.e. the link to MetaActions)
@@ -210,26 +213,29 @@ function Action(name, doc, ldoc, func){
var handlers = getHandlers.call(this, name)
.map(function(h){ return h.apply(that, args) })
+ // XXX use the last return as result...
+ var res = handlers.slice(-1)[0]
+
// NOTE: this action will get included and called by the code
// above and below, so no need to explicitly call func...
// call handlers -- post phase...
// NOTE: post handlers need to get called last run pre first run post...
- handlers.reverse().forEach(function(h){
+ handlers.reverse().forEach(function(h, i){
// function...
if(h instanceof Function){
- //h.call(that, res)
- h.call(that)
+ var r = h.call(that)
+ res = i == 0 ? r : res
// deferred...
} else if(h != null && h.resolve instanceof Function){
- //h.resolve(res)
h.resolve()
+ res = i == 0 ? h : res
}
})
- //return res
- return this
+ return res || this
+ //return this
}
meth.__proto__ = this.__proto__
diff --git a/ui (gen4)/lib/jli.js b/ui (gen4)/lib/jli.js
index ccf2050b..e960fe9f 100755
--- a/ui (gen4)/lib/jli.js
+++ b/ui (gen4)/lib/jli.js
@@ -117,6 +117,8 @@ var USE_3D_TRANSFORM = true
//
// NOTE: for single state toggling, 'none' will get passed to
// state_accessor to indicate an "empty" state...
+// NOTE: if elem is a function it will be called in the same context as
+// the toggler and is expected to return the element.
//
// XXX technically we do not need both elem and state_accessor here, the
// later is enough, but as strict mode is not stable enough (sometimes
@@ -153,6 +155,8 @@ function makeToggler(elem, state_accessor, states, callback_a, callback_b){
var action = b == 'next' ? null : b
}
+ e = e instanceof Function ? e.call(this) : e
+
// XXX is this correct???
var args = args2array(arguments).slice(2)
diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js
index d6673be0..893a179e 100755
--- a/ui (gen4)/ui.js
+++ b/ui (gen4)/ui.js
@@ -94,6 +94,9 @@ module.GLOBAL_KEYBOARD = {
// XXX testing...
+ Enter: 'toggleSingleImage',
+ B: 'toggleTheme',
+
Home: {
default: 'firstImage',
ctrl: 'firstGlobalImage',
diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js
index 9de9cfa3..a3249093 100755
--- a/ui (gen4)/viewer.js
+++ b/ui (gen4)/viewer.js
@@ -572,10 +572,11 @@ actions.Actions(Client, {
function(){
toggleFullscreenMode()
}],
- toggleSingleImage: ['',
- function(){
- // XXX
- }],
+ toggleSingleImage: ['Toggle single image view',
+ // XXX this is wrong!!!
+ makeCSSClassToggler(
+ function(){ return this.ribbons.viewer },
+ 'single-image-mode') ],
// XXX revise this...
showDevTools: ['',
function(){
@@ -584,6 +585,14 @@ actions.Actions(Client, {
}
}],
+ toggleTheme: ['',
+ makeCSSClassToggler(
+ function(){ return this.ribbons.viewer },
+ [
+ 'gray',
+ 'dark',
+ 'light'
+ ]) ],
// align modes...
// XXX skip invisible ribbons (???)