mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ea773dafd4
commit
499c04a2c4
@ -37,7 +37,8 @@ var SlideshowActions = actions.Actions({
|
|||||||
'slideshow-direction': 'forward',
|
'slideshow-direction': 'forward',
|
||||||
'slideshow-interval': '3s',
|
'slideshow-interval': '3s',
|
||||||
'slideshow-interval-max-count': 7,
|
'slideshow-interval-max-count': 7,
|
||||||
'slideshow-hold': 'on',
|
|
||||||
|
'slideshow-pause-on-blur': true,
|
||||||
|
|
||||||
'slideshow-intervals': [
|
'slideshow-intervals': [
|
||||||
'0.2s',
|
'0.2s',
|
||||||
@ -48,7 +49,6 @@ var SlideshowActions = actions.Actions({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX should this take the slideshow off pause if paused???
|
|
||||||
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
||||||
toggler.CSSClassToggler(
|
toggler.CSSClassToggler(
|
||||||
function(){ return this.dom },
|
function(){ return this.dom },
|
||||||
@ -183,9 +183,17 @@ var SlideshowActions = actions.Actions({
|
|||||||
|
|
||||||
return o
|
return o
|
||||||
})],
|
})],
|
||||||
|
|
||||||
slideshowButtonAction: ['- Slideshow/',
|
slideshowButtonAction: ['- Slideshow/',
|
||||||
core.doc`
|
core.doc`Slideshow button action
|
||||||
|
|
||||||
|
This differs from .toggleSlideshow() in that it also handles the paused
|
||||||
|
timer/slideshow state according to the following FSM:
|
||||||
|
|
||||||
|
off <--> on <--- paused
|
||||||
|
|
||||||
|
i.e. if the slideshow is paused it will resume it otherwise stop/start.
|
||||||
|
|
||||||
|
NOTE: this is not a toggler.
|
||||||
`,
|
`,
|
||||||
function(){
|
function(){
|
||||||
return this.toggleSlideshowTimer('?') == 'paused' ?
|
return this.toggleSlideshowTimer('?') == 'paused' ?
|
||||||
@ -237,8 +245,8 @@ var SlideshowActions = actions.Actions({
|
|||||||
toggleSlideshowLooping: ['- Slideshow/Slideshow $looping',
|
toggleSlideshowLooping: ['- Slideshow/Slideshow $looping',
|
||||||
core.makeConfigToggler('slideshow-looping', ['on', 'off'])],
|
core.makeConfigToggler('slideshow-looping', ['on', 'off'])],
|
||||||
|
|
||||||
toggleSlideshowHold: ['Interface|Slideshow/Slideshow $hold',
|
toggleSlideshowPauseOnBlur: ['Interface|Slideshow/Slideshow pause on app blur',
|
||||||
core.makeConfigToggler('slideshow-hold', ['on', 'off'])],
|
core.makeConfigToggler('slideshow-pause-on-blur', ['on', 'off'])],
|
||||||
|
|
||||||
resetSlideshowTimer: ['- Slideshow/Reset slideshow timer',
|
resetSlideshowTimer: ['- Slideshow/Reset slideshow timer',
|
||||||
function(){
|
function(){
|
||||||
@ -352,7 +360,7 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
|||||||
['stop',
|
['stop',
|
||||||
function(){ this.toggleSlideshow('off') }],
|
function(){ this.toggleSlideshow('off') }],
|
||||||
|
|
||||||
// slideshow pause...
|
// slideshow pause on click or blur...
|
||||||
['toggleSlideshow',
|
['toggleSlideshow',
|
||||||
function(){
|
function(){
|
||||||
var that = this
|
var that = this
|
||||||
@ -379,28 +387,30 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
|||||||
: this.dom.off('click', toggle)
|
: this.dom.off('click', toggle)
|
||||||
|
|
||||||
// toggle on blur/focus...
|
// toggle on blur/focus...
|
||||||
var user_paused = false
|
if(this.config['slideshow-pause-on-blur'] !== false){
|
||||||
var focus_debounce = false
|
var user_paused = false
|
||||||
var blur = this.__slideshow_blur_handler
|
var focus_debounce = false
|
||||||
= this.__slideshow_blur_handler
|
var blur = this.__slideshow_blur_handler
|
||||||
|| function(){
|
= this.__slideshow_blur_handler
|
||||||
if(!focus_debounce){
|
|| function(){
|
||||||
user_paused = that.toggleSlideshowTimer('?') == 'paused'
|
if(!focus_debounce){
|
||||||
that.toggleSlideshowTimer('paused')
|
user_paused = that.toggleSlideshowTimer('?') == 'paused'
|
||||||
focus_debounce = true } }
|
that.toggleSlideshowTimer('paused')
|
||||||
var focus = this.__slideshow_focus_handler
|
focus_debounce = true } }
|
||||||
= this.__slideshow_focus_handler
|
var focus = this.__slideshow_focus_handler
|
||||||
|| function(){
|
= this.__slideshow_focus_handler
|
||||||
focus_debounce = false
|
|| function(){
|
||||||
user_paused
|
focus_debounce = false
|
||||||
|| that.toggleSlideshowTimer('running') }
|
user_paused
|
||||||
running ?
|
|| that.toggleSlideshowTimer('running') }
|
||||||
this.dom
|
running ?
|
||||||
.on('blur', blur)
|
this.dom
|
||||||
.on('focus', focus)
|
.on('blur', blur)
|
||||||
: this.dom
|
.on('focus', focus)
|
||||||
.off('blur', blur)
|
: this.dom
|
||||||
.off('focus', focus)
|
.off('blur', blur)
|
||||||
|
.off('focus', focus)
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// pause/resume slideshow on modal stuff...
|
// pause/resume slideshow on modal stuff...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user