tweaking the slideshow mode...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-01 20:16:45 +04:00
parent cf0b7ad7fc
commit 28d584b9ce
3 changed files with 25 additions and 6 deletions

View File

@ -46,8 +46,9 @@ var KEYBOARD_CONFIG = {
// their bindings priority... // their bindings priority...
'.help-mode': { '.help-mode': {
title: 'Help', title: 'Help',
doc: 'NOTE: In this mode all other key bindings are disabled, except '+ doc: 'To enter this mode press <b>H</b> or <b>?</b>.<br>'+
'the ones explicitly defined here.', 'NOTE: In this mode all other key bindings are disabled, '+
'except the ones explicitly defined here.',
ignore: '*', ignore: '*',
Esc: doc('Close help', Esc: doc('Close help',
@ -65,11 +66,20 @@ var KEYBOARD_CONFIG = {
// //
'.slideshow-mode': { '.slideshow-mode': {
title: 'Slideshow mode', title: 'Slideshow mode',
doc: 'To enter this mode press <b>S</b>.',
// XXX think about what else to disable here...
ignore: [ ignore: [
'Up', 'Down', 'Enter', 'Up', 'Down', 'Enter', 'R', 'L',
], ],
L: doc('Toggle slideshow looping',
function(){
SLIDESHOW_LOOP = SLIDESHOW_LOOP ? false : true
showStatus('Slideshow: looping', SLIDESHOW_LOOP ? 'enabled...' : 'disabled...')
return false
}),
Esc: doc('Exit/stop slideshow', Esc: doc('Exit/stop slideshow',
function(){ function(){
toggleSlideShowMode('off') toggleSlideShowMode('off')
@ -84,6 +94,7 @@ var KEYBOARD_CONFIG = {
// //
'.single-image-mode': { '.single-image-mode': {
title: 'Single image mode', title: 'Single image mode',
doc: 'To toggle between this and ribbon modes press <b>Enter</b>.',
// XXX this should only work on single image mode... // XXX this should only work on single image mode...
F: doc('Toggle view proportions', F: doc('Toggle view proportions',
@ -104,6 +115,7 @@ var KEYBOARD_CONFIG = {
// //
'.marked-only-view:not(.single-image-mode)': { '.marked-only-view:not(.single-image-mode)': {
title: 'Marked only view', title: 'Marked only view',
doc: 'To toggle this mode press <b>shift-F2</b>.',
Esc: doc('Exit marked only view', Esc: doc('Exit marked only view',
function(){ function(){

View File

@ -162,6 +162,7 @@ function createCSSClassToggler(elem, class_list, callback_a, callback_b){
// pre callback... // pre callback...
if(callback_pre != null){ if(callback_pre != null){
if(callback_pre.call(this, action) === false){ if(callback_pre.call(this, action) === false){
// XXX should we return action here???
return return
} }
} }

View File

@ -12,6 +12,12 @@
// XXX make this save and restore settings... // XXX make this save and restore settings...
var toggleSingleImageMode = createCSSClassToggler('.viewer', var toggleSingleImageMode = createCSSClassToggler('.viewer',
'single-image-mode', 'single-image-mode',
function(action){
// prevent reiniting...
if(action == toggleSingleImageMode('?')){
return false
}
},
function(action){ function(action){
var w = getScreenWidthInImages() var w = getScreenWidthInImages()
@ -59,10 +65,10 @@ var SLIDESHOW_INTERVAL = 3000
var SLIDESHOW_LOOP = true var SLIDESHOW_LOOP = true
var SLIDESHOW_DIRECTION = 'next' var SLIDESHOW_DIRECTION = 'next'
// TODO account for ribbon start/end (loop or stop slideshow)
// TODO transitions... // TODO transitions...
// TODO a real setup UI (instead of prompt) // TODO a real setup UI (instead of prompt)
var toggleSlideShowMode = createCSSClassToggler('.viewer', '.slideshow-mode', var toggleSlideShowMode = createCSSClassToggler('.viewer',
'.slideshow-mode',
function(action){ function(action){
if(action == 'on'){ if(action == 'on'){
updateStatus('Slideshow...').show() updateStatus('Slideshow...').show()
@ -80,7 +86,7 @@ var toggleSlideShowMode = createCSSClassToggler('.viewer', '.slideshow-mode',
SLIDESHOW_INTERVAL = isNaN(interval) ? 3000 : interval*1000 SLIDESHOW_INTERVAL = isNaN(interval) ? 3000 : interval*1000
showStatus('Slideshow: starting...') showStatus('Slideshow: starting', SLIDESHOW_LOOP ? 'looped...' : 'unlooped...')
toggleSingleImageMode('on') toggleSingleImageMode('on')
_slideshow_timer = setInterval(function(){ _slideshow_timer = setInterval(function(){