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-looping': 'on',
|
||||||
'slideshow-direction': 'forward',
|
'slideshow-direction': 'forward',
|
||||||
'slideshow-interval': '3s',
|
'slideshow-interval': '3s',
|
||||||
'slideshow-interval-max-count': 7,
|
|
||||||
|
|
||||||
'slideshow-pause-on-blur': true,
|
|
||||||
|
|
||||||
'slideshow-intervals': [
|
'slideshow-intervals': [
|
||||||
'0.2s',
|
'0.2s',
|
||||||
'1s',
|
'1s',
|
||||||
@ -47,6 +43,10 @@ var SlideshowActions = actions.Actions({
|
|||||||
'5s',
|
'5s',
|
||||||
'7s',
|
'7s',
|
||||||
],
|
],
|
||||||
|
'slideshow-interval-max-count': 7,
|
||||||
|
|
||||||
|
'slideshow-pause-on-blur': true,
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
||||||
@ -133,62 +133,11 @@ var SlideshowActions = actions.Actions({
|
|||||||
slideshowDialog: ['Slideshow/Slideshow...',
|
slideshowDialog: ['Slideshow/Slideshow...',
|
||||||
widgets.makeUIDialog(function(){
|
widgets.makeUIDialog(function(){
|
||||||
var that = this
|
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()
|
|
||||||
|
|
||||||
// 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
|
|
||||||
// suspend the timer if it's not suspended outside...
|
// suspend the timer if it's not suspended outside...
|
||||||
var suspended_timer = this.__slideshow_timer == 'suspended'
|
var suspended_timer = this.__slideshow_timer == 'suspended'
|
||||||
suspended_timer
|
suspended_timer
|
||||||
|| this.suspendSlideshowTimer()
|
|| this.suspendSlideshowTimer()
|
||||||
var spec
|
|
||||||
|
|
||||||
return browse.makeLister(null,
|
return browse.makeLister(null,
|
||||||
function(path, make){
|
function(path, make){
|
||||||
@ -196,35 +145,22 @@ var SlideshowActions = actions.Actions({
|
|||||||
that.makeEditor(make,
|
that.makeEditor(make,
|
||||||
spec = spec
|
spec = spec
|
||||||
|| [
|
|| [
|
||||||
// XXX move this to the interval editor...
|
|
||||||
{ title: '$Interval: ',
|
{ title: '$Interval: ',
|
||||||
type: 'configToggle',
|
type: 'configToggle',
|
||||||
key: 'slideshow-interval',
|
key: 'slideshow-interval',
|
||||||
values_key: 'slideshow-intervals',
|
values_key: 'slideshow-intervals',
|
||||||
/* XXX
|
nonstrict: true,
|
||||||
list: function(cur, set){
|
list: function(cur, set){
|
||||||
this.slideshowIntervalDialog()
|
this.slideshowIntervalDialog()
|
||||||
.close(function(){
|
.close(function(){ set() }) }, },
|
||||||
// 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, }, },
|
|
||||||
//*/
|
|
||||||
{ title: '$Direction: ',
|
{ title: '$Direction: ',
|
||||||
type: 'toggler',
|
type: 'toggler',
|
||||||
toggler: 'toggleSlideshowDirection', },
|
toggler: 'toggleSlideshowDirection',
|
||||||
|
live_update: true, },
|
||||||
{ title: '$Looping: ',
|
{ title: '$Looping: ',
|
||||||
type: 'toggler',
|
type: 'toggler',
|
||||||
toggler: 'toggleSlideshowLooping', }, ])
|
toggler: 'toggleSlideshowLooping',
|
||||||
|
live_update: true, }, ])
|
||||||
// Start/stop...
|
// Start/stop...
|
||||||
make([function(){
|
make([function(){
|
||||||
return that.toggleSlideshow('?') == 'on' ? '$Stop' : '$Start' }],
|
return that.toggleSlideshow('?') == 'on' ? '$Stop' : '$Start' }],
|
||||||
@ -234,8 +170,8 @@ var SlideshowActions = actions.Actions({
|
|||||||
},{
|
},{
|
||||||
path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start',
|
path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start',
|
||||||
cls: 'table-view tail-action',
|
cls: 'table-view tail-action',
|
||||||
|
// reset the timer if it was not suspended outside...
|
||||||
close: function(){
|
close: function(){
|
||||||
// reset the timer if it was not suspended outside...
|
|
||||||
suspended_timer
|
suspended_timer
|
||||||
|| that.resetSlideshowTimer() },
|
|| that.resetSlideshowTimer() },
|
||||||
}) })],
|
}) })],
|
||||||
@ -258,7 +194,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
|
|
||||||
// settings...
|
// settings...
|
||||||
// NOTE: these are disabled as they are repeated in the slideshow dialog...
|
// 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...',
|
slideshowIntervalDialog: ['- Slideshow/Slideshow $interval...',
|
||||||
widgets.makeUIDialog(function(parent){
|
widgets.makeUIDialog(function(parent){
|
||||||
var that = this
|
var that = this
|
||||||
@ -290,8 +226,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
parent.update()
|
parent.update()
|
||||||
.then(function(){
|
.then(function(){
|
||||||
txt != ''
|
txt != ''
|
||||||
&& parent.select(txt)
|
&& parent.select(txt) })
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return dialog
|
return dialog
|
||||||
@ -304,6 +239,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
toggleSlideshowPauseOnBlur: ['Interface|Slideshow/Slideshow pause on app blur',
|
toggleSlideshowPauseOnBlur: ['Interface|Slideshow/Slideshow pause on app blur',
|
||||||
core.makeConfigToggler('slideshow-pause-on-blur', ['on', 'off'])],
|
core.makeConfigToggler('slideshow-pause-on-blur', ['on', 'off'])],
|
||||||
|
|
||||||
|
// XXX make these stack-like...
|
||||||
resetSlideshowTimer: ['- Slideshow/Reset slideshow timer',
|
resetSlideshowTimer: ['- Slideshow/Reset slideshow timer',
|
||||||
function(){
|
function(){
|
||||||
this.__slideshow_timer && this.toggleSlideshow('on') }],
|
this.__slideshow_timer && this.toggleSlideshow('on') }],
|
||||||
@ -314,6 +250,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
this.__slideshow_timer = 'suspended'
|
this.__slideshow_timer = 'suspended'
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
toggleSlideshowTimer: ['Slideshow/Pause or resume running slideshow',
|
toggleSlideshowTimer: ['Slideshow/Pause or resume running slideshow',
|
||||||
core.doc`
|
core.doc`
|
||||||
|
|
||||||
|
|||||||
@ -972,24 +972,25 @@ var EditorActions = actions.Actions({
|
|||||||
// NOTE: we are not supporting aliases here as we need to pass strings
|
// 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
|
// as-is into .makeEditorBlock(..)'s spec to be able to create things
|
||||||
// like '---' -> <hr> and other stuff...
|
// like '---' -> <hr> and other stuff...
|
||||||
|
//
|
||||||
|
// XXX should we support dialog.close(..)'s reject mode???
|
||||||
__editor_fields__: {
|
__editor_fields__: {
|
||||||
// Generic field...
|
// Generic field...
|
||||||
//
|
//
|
||||||
// options format:
|
// options format:
|
||||||
// {
|
// {
|
||||||
|
// type: <type>,
|
||||||
|
//
|
||||||
// // NOTE: if this is not set then the id is used...
|
// // NOTE: if this is not set then the id is used...
|
||||||
// title: <str>,
|
// title: <str>,
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// // value...
|
// // value...
|
||||||
// //
|
// //
|
||||||
// value: <value> | <func([value])>,
|
// value: <value> | <func([value])>,
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// // XXX not implemented...
|
// // XXX not implemented...
|
||||||
// doc: <str> | <func>,
|
// doc: <str> | <func>,
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -1019,6 +1020,9 @@ var EditorActions = actions.Actions({
|
|||||||
// {
|
// {
|
||||||
// values: <array> | <func([values])>,
|
// values: <array> | <func([values])>,
|
||||||
//
|
//
|
||||||
|
// // if true this will only alow setting .value from .values...
|
||||||
|
// nonstrict: <bool>,
|
||||||
|
//
|
||||||
// // XXX not implemented...
|
// // XXX not implemented...
|
||||||
// value_editable: <bool>,
|
// value_editable: <bool>,
|
||||||
//
|
//
|
||||||
@ -1053,15 +1057,12 @@ var EditorActions = actions.Actions({
|
|||||||
type: 'toggle',
|
type: 'toggle',
|
||||||
|
|
||||||
open: function(evt){
|
open: function(evt){
|
||||||
var values = options.values instanceof Function ?
|
var getValues = function(){
|
||||||
|
return options.values instanceof Function ?
|
||||||
options.values.call(actions)
|
options.values.call(actions)
|
||||||
: options.values ?
|
: options.values ?
|
||||||
options.values
|
options.values
|
||||||
: ['off', 'on']
|
: ['off', 'on'] }
|
||||||
|
|
||||||
var elem = $(this).find('.text').last()
|
|
||||||
var current = elem.text()
|
|
||||||
|
|
||||||
var set = function(v){
|
var set = function(v){
|
||||||
// get current value...
|
// get current value...
|
||||||
v = arguments.length > 0 ?
|
v = arguments.length > 0 ?
|
||||||
@ -1070,18 +1071,35 @@ var EditorActions = actions.Actions({
|
|||||||
options.value.call(actions)
|
options.value.call(actions)
|
||||||
: options.value
|
: options.value
|
||||||
// normalize...
|
// normalize...
|
||||||
v = values.includes(v) ?
|
// NOTE: we are re-getting the values here
|
||||||
v
|
// as it can get updated in options.list(..)
|
||||||
: values[0]
|
// or via options.values(..)...
|
||||||
|
if(!options.nonstrict){
|
||||||
|
var values = getValues()
|
||||||
|
v = values.includes(v) ?
|
||||||
|
v
|
||||||
|
: values[0] }
|
||||||
// update the value...
|
// update the value...
|
||||||
options.value instanceof Function ?
|
// NOTE: we update the local value iff set(..)
|
||||||
(v = options.value.call(actions, v))
|
// got an explicit value argument...
|
||||||
: (options.value = v)
|
// 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))
|
||||||
elem.text(v)
|
elem.text(v)
|
||||||
// update dialog...
|
// update dialog...
|
||||||
options.doNotAutoUpdateDialog
|
options.doNotAutoUpdateDialog
|
||||||
|| make.dialog.update() }
|
|| 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...
|
// editable list or more than 2 values -> show value list...
|
||||||
if(options.list_editable
|
if(options.list_editable
|
||||||
|| (values.length > 2
|
|| (values.length > 2
|
||||||
@ -1188,8 +1206,6 @@ var EditorActions = actions.Actions({
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// NOTE: this extends .toggle(..)
|
// NOTE: this extends .toggle(..)
|
||||||
//
|
|
||||||
// XXX should we support dialog.close(..)'s reject mode here???
|
|
||||||
attrToggle: function(actions, make, options){
|
attrToggle: function(actions, make, options){
|
||||||
var update = function(){
|
var update = function(){
|
||||||
if(!options.read_only){
|
if(!options.read_only){
|
||||||
@ -1250,6 +1266,7 @@ var EditorActions = actions.Actions({
|
|||||||
options)) },
|
options)) },
|
||||||
|
|
||||||
|
|
||||||
|
// Toggler-based field...
|
||||||
//
|
//
|
||||||
// options format:
|
// options format:
|
||||||
// {
|
// {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user