mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
minor tweaks and fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
59ef1fffb2
commit
3c9b552c39
@ -36,10 +36,6 @@ var SlideshowActions = actions.Actions({
|
||||
'slideshow-looping': 'on',
|
||||
'slideshow-direction': 'forward',
|
||||
'slideshow-interval': '3s',
|
||||
'slideshow-interval-max-count': 7,
|
||||
|
||||
'slideshow-pause-on-blur': true,
|
||||
|
||||
'slideshow-intervals': [
|
||||
'0.2s',
|
||||
'1s',
|
||||
@ -47,6 +43,10 @@ var SlideshowActions = actions.Actions({
|
||||
'5s',
|
||||
'7s',
|
||||
],
|
||||
'slideshow-interval-max-count': 7,
|
||||
|
||||
'slideshow-pause-on-blur': true,
|
||||
|
||||
},
|
||||
|
||||
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
||||
@ -133,62 +133,11 @@ var SlideshowActions = actions.Actions({
|
||||
slideshowDialog: ['Slideshow/Slideshow...',
|
||||
widgets.makeUIDialog(function(){
|
||||
var that = this
|
||||
|
||||
// suspend the timer if it's not suspended outside...
|
||||
var suspended_timer = this.__slideshow_timer == 'suspended'
|
||||
suspended_timer || this.suspendSlideshowTimer()
|
||||
|
||||
// XXX might be a good idea to make this generic...
|
||||
var _makeToggleHandler = function(o, toggler){
|
||||
return function(){
|
||||
var txt = $(this).find('.text').first().text()
|
||||
that[toggler]()
|
||||
o.update()
|
||||
.then(function(){ o.select(txt) })
|
||||
that.toggleSlideshow('?') == 'on'
|
||||
&& o.close()
|
||||
}
|
||||
}
|
||||
|
||||
return browse.makeLister(null, function(path, make){
|
||||
make(['$Interval: ',
|
||||
function(){ return that.config['slideshow-interval'] }])
|
||||
.on('open', function(){
|
||||
that.slideshowIntervalDialog(make.dialog) })
|
||||
|
||||
make(['$Direction: ',
|
||||
function(){ return that.config['slideshow-direction'] }])
|
||||
.on('open', _makeToggleHandler(make.dialog, 'toggleSlideshowDirection'))
|
||||
make(['$Looping: ',
|
||||
function(){ return that.config['slideshow-looping'] }])
|
||||
.on('open', _makeToggleHandler(make.dialog, 'toggleSlideshowLooping'))
|
||||
|
||||
// Start/stop...
|
||||
make([function(){
|
||||
return that.toggleSlideshow('?') == 'on' ? '$Stop' : '$Start' }])
|
||||
.on('open', function(){
|
||||
that.toggleSlideshow()
|
||||
make.dialog.close()
|
||||
})
|
||||
},
|
||||
{
|
||||
path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start',
|
||||
cls: 'table-view tail-action',
|
||||
})
|
||||
.on('close', function(){
|
||||
// reset the timer if it was not suspended outside...
|
||||
suspended_timer
|
||||
|| that.resetSlideshowTimer()
|
||||
})
|
||||
})],
|
||||
slideshowDialog2: ['Slideshow/Slideshow (new)...',
|
||||
widgets.makeUIDialog(function(){
|
||||
var that = this
|
||||
var spec
|
||||
// suspend the timer if it's not suspended outside...
|
||||
var suspended_timer = this.__slideshow_timer == 'suspended'
|
||||
suspended_timer
|
||||
|| this.suspendSlideshowTimer()
|
||||
var spec
|
||||
|
||||
return browse.makeLister(null,
|
||||
function(path, make){
|
||||
@ -196,35 +145,22 @@ var SlideshowActions = actions.Actions({
|
||||
that.makeEditor(make,
|
||||
spec = spec
|
||||
|| [
|
||||
// XXX move this to the interval editor...
|
||||
{ title: '$Interval: ',
|
||||
type: 'configToggle',
|
||||
key: 'slideshow-interval',
|
||||
values_key: 'slideshow-intervals',
|
||||
/* XXX
|
||||
nonstrict: true,
|
||||
list: function(cur, set){
|
||||
this.slideshowIntervalDialog()
|
||||
.close(function(){
|
||||
// XXX this works only once per dialog instance...
|
||||
set() }) }, },
|
||||
/*/
|
||||
values_key: 'slideshow-intervals',
|
||||
list_editable: true,
|
||||
list: {
|
||||
length_limit: that.config['slideshow-interval-max-count'],
|
||||
check: Date.str2ms,
|
||||
unique: Date.str2ms,
|
||||
normalize: function(e){ return e.trim() },
|
||||
sort: function(a, b){
|
||||
return Date.str2ms(a) - Date.str2ms(b) },
|
||||
sortable: false, }, },
|
||||
//*/
|
||||
.close(function(){ set() }) }, },
|
||||
{ title: '$Direction: ',
|
||||
type: 'toggler',
|
||||
toggler: 'toggleSlideshowDirection', },
|
||||
toggler: 'toggleSlideshowDirection',
|
||||
live_update: true, },
|
||||
{ title: '$Looping: ',
|
||||
type: 'toggler',
|
||||
toggler: 'toggleSlideshowLooping', }, ])
|
||||
toggler: 'toggleSlideshowLooping',
|
||||
live_update: true, }, ])
|
||||
// Start/stop...
|
||||
make([function(){
|
||||
return that.toggleSlideshow('?') == 'on' ? '$Stop' : '$Start' }],
|
||||
@ -234,8 +170,8 @@ var SlideshowActions = actions.Actions({
|
||||
},{
|
||||
path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start',
|
||||
cls: 'table-view tail-action',
|
||||
close: function(){
|
||||
// reset the timer if it was not suspended outside...
|
||||
close: function(){
|
||||
suspended_timer
|
||||
|| that.resetSlideshowTimer() },
|
||||
}) })],
|
||||
@ -258,7 +194,7 @@ var SlideshowActions = actions.Actions({
|
||||
|
||||
// settings...
|
||||
// NOTE: these are disabled as they are repeated in the slideshow dialog...
|
||||
// XXX do we need both these and the dialog???
|
||||
// XXX do we need both this and .slideshowDialog(???)???
|
||||
slideshowIntervalDialog: ['- Slideshow/Slideshow $interval...',
|
||||
widgets.makeUIDialog(function(parent){
|
||||
var that = this
|
||||
@ -290,8 +226,7 @@ var SlideshowActions = actions.Actions({
|
||||
parent.update()
|
||||
.then(function(){
|
||||
txt != ''
|
||||
&& parent.select(txt)
|
||||
})
|
||||
&& parent.select(txt) })
|
||||
}
|
||||
})
|
||||
return dialog
|
||||
@ -304,6 +239,7 @@ var SlideshowActions = actions.Actions({
|
||||
toggleSlideshowPauseOnBlur: ['Interface|Slideshow/Slideshow pause on app blur',
|
||||
core.makeConfigToggler('slideshow-pause-on-blur', ['on', 'off'])],
|
||||
|
||||
// XXX make these stack-like...
|
||||
resetSlideshowTimer: ['- Slideshow/Reset slideshow timer',
|
||||
function(){
|
||||
this.__slideshow_timer && this.toggleSlideshow('on') }],
|
||||
@ -314,6 +250,7 @@ var SlideshowActions = actions.Actions({
|
||||
this.__slideshow_timer = 'suspended'
|
||||
}
|
||||
}],
|
||||
|
||||
toggleSlideshowTimer: ['Slideshow/Pause or resume running slideshow',
|
||||
core.doc`
|
||||
|
||||
|
||||
@ -972,24 +972,25 @@ var EditorActions = actions.Actions({
|
||||
// NOTE: we are not supporting aliases here as we need to pass strings
|
||||
// as-is into .makeEditorBlock(..)'s spec to be able to create things
|
||||
// like '---' -> <hr> and other stuff...
|
||||
//
|
||||
// XXX should we support dialog.close(..)'s reject mode???
|
||||
__editor_fields__: {
|
||||
// Generic field...
|
||||
//
|
||||
// options format:
|
||||
// {
|
||||
// type: <type>,
|
||||
//
|
||||
// // NOTE: if this is not set then the id is used...
|
||||
// title: <str>,
|
||||
//
|
||||
//
|
||||
// // value...
|
||||
// //
|
||||
// value: <value> | <func([value])>,
|
||||
//
|
||||
//
|
||||
// // XXX not implemented...
|
||||
// doc: <str> | <func>,
|
||||
//
|
||||
//
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
@ -1019,6 +1020,9 @@ var EditorActions = actions.Actions({
|
||||
// {
|
||||
// values: <array> | <func([values])>,
|
||||
//
|
||||
// // if true this will only alow setting .value from .values...
|
||||
// nonstrict: <bool>,
|
||||
//
|
||||
// // XXX not implemented...
|
||||
// value_editable: <bool>,
|
||||
//
|
||||
@ -1053,15 +1057,12 @@ var EditorActions = actions.Actions({
|
||||
type: 'toggle',
|
||||
|
||||
open: function(evt){
|
||||
var values = options.values instanceof Function ?
|
||||
var getValues = function(){
|
||||
return options.values instanceof Function ?
|
||||
options.values.call(actions)
|
||||
: options.values ?
|
||||
options.values
|
||||
: ['off', 'on']
|
||||
|
||||
var elem = $(this).find('.text').last()
|
||||
var current = elem.text()
|
||||
|
||||
: ['off', 'on'] }
|
||||
var set = function(v){
|
||||
// get current value...
|
||||
v = arguments.length > 0 ?
|
||||
@ -1070,18 +1071,35 @@ var EditorActions = actions.Actions({
|
||||
options.value.call(actions)
|
||||
: options.value
|
||||
// normalize...
|
||||
// NOTE: we are re-getting the values here
|
||||
// as it can get updated in options.list(..)
|
||||
// or via options.values(..)...
|
||||
if(!options.nonstrict){
|
||||
var values = getValues()
|
||||
v = values.includes(v) ?
|
||||
v
|
||||
: values[0]
|
||||
: values[0] }
|
||||
// update the value...
|
||||
options.value instanceof Function ?
|
||||
// NOTE: we update the local value iff set(..)
|
||||
// got an explicit value argument...
|
||||
// calling set(..) will not store anything,
|
||||
// just update the current state, either to
|
||||
// the already stored value or to the output
|
||||
// of .value(..)...
|
||||
arguments.length > 0
|
||||
&& (options.value instanceof Function ?
|
||||
(v = options.value.call(actions, v))
|
||||
: (options.value = v)
|
||||
: (options.value = v))
|
||||
elem.text(v)
|
||||
// update dialog...
|
||||
options.doNotAutoUpdateDialog
|
||||
|| make.dialog.update() }
|
||||
|
||||
|
||||
var elem = $(this).find('.text').last()
|
||||
var current = elem.text()
|
||||
var values = getValues()
|
||||
|
||||
// editable list or more than 2 values -> show value list...
|
||||
if(options.list_editable
|
||||
|| (values.length > 2
|
||||
@ -1188,8 +1206,6 @@ var EditorActions = actions.Actions({
|
||||
//
|
||||
//
|
||||
// NOTE: this extends .toggle(..)
|
||||
//
|
||||
// XXX should we support dialog.close(..)'s reject mode here???
|
||||
attrToggle: function(actions, make, options){
|
||||
var update = function(){
|
||||
if(!options.read_only){
|
||||
@ -1250,6 +1266,7 @@ var EditorActions = actions.Actions({
|
||||
options)) },
|
||||
|
||||
|
||||
// Toggler-based field...
|
||||
//
|
||||
// options format:
|
||||
// {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user