diff --git a/ui/marks.js b/ui/marks.js index e8ecfb55..f3ff63a5 100755 --- a/ui/marks.js +++ b/ui/marks.js @@ -66,8 +66,11 @@ var getMarkedGIDBefore = makeGIDBeforeGetterFromList( // - toggle img_class on the target image // - add/remove a mark element after the image // - toggle mark_class on the mark element +// - call the callback, if defined, passing it: +// - gid +// - action ('on' on 'off') // - trigger the evt_name on the viewer passing it: -// - target image +// - gid // - action ('on' on 'off') // // The actual toggler is built with createCSSClassToggler(..), see its @@ -83,6 +86,8 @@ var getMarkedGIDBefore = makeGIDBeforeGetterFromList( // - 'off' : force remove mark // - 'next' : toggle next state (default) // NOTE: when passing this a gid, the 'next' action is not supported +// +// XXX do we need a pre-callback here??? function makeMarkToggler(img_class, mark_class, evt_name, callback){ return createCSSClassToggler( '.current.image', @@ -110,7 +115,9 @@ function makeMarkToggler(img_class, mark_class, evt_name, callback){ } } - callback(gid, action) + if(callback != null){ + callback(gid, action) + } $('.viewer').trigger(evt_name, [gid, action]) }) @@ -138,6 +145,7 @@ function makeMarkUpdater(img_class, mark_class, test){ } + /********************************************************************** * Basic marks... */