2013-02-12 01:28:52 +04:00
|
|
|
/**********************************************************************
|
|
|
|
|
*
|
|
|
|
|
* XXX add copyright and licence info...
|
|
|
|
|
*
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
2013-02-22 01:19:04 +04:00
|
|
|
var DEFAULT_TRANSITION_DURATION = 200
|
2013-02-27 16:49:47 +04:00
|
|
|
|
2013-02-22 01:19:04 +04:00
|
|
|
var INNERTIA_SCALE = 0.25
|
|
|
|
|
|
2014-02-04 01:45:23 +04:00
|
|
|
var MAX_DISTANCE_TO_SCROLL = 1000
|
|
|
|
|
|
2013-02-12 02:23:29 +04:00
|
|
|
|
2013-02-12 01:28:52 +04:00
|
|
|
/********************************************************** layout ***/
|
|
|
|
|
|
2013-02-26 04:17:29 +04:00
|
|
|
var toggleThemes = createCSSClassToggler('.chrome', [
|
2013-03-01 13:22:31 +04:00
|
|
|
'light-viewer',
|
2013-02-26 04:17:29 +04:00
|
|
|
// this is the default (no class set)...
|
|
|
|
|
'none',
|
2013-03-01 13:22:31 +04:00
|
|
|
'dark-viewer'
|
2013-02-26 04:17:29 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
2013-03-06 21:18:54 +04:00
|
|
|
// XXX this is neither final nor usable...
|
|
|
|
|
function prepareInlineCaptions(){
|
|
|
|
|
$('.page img[title]').each(function(){
|
|
|
|
|
// XXX make this add same style captions to images without changing
|
|
|
|
|
// layout...
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-06 04:06:50 +04:00
|
|
|
|
2013-02-12 01:28:52 +04:00
|
|
|
|
2013-02-19 19:34:03 +04:00
|
|
|
/************************************************** event handlers ***/
|
|
|
|
|
|
2013-03-06 05:32:49 +04:00
|
|
|
// Click on caption...
|
2013-03-06 21:18:54 +04:00
|
|
|
// XXX add inline caption support...
|
2014-04-19 13:37:20 +04:00
|
|
|
function handleCaption(elem){
|
|
|
|
|
//elem = $(data.orig_event.target)
|
|
|
|
|
elem = elem == null ? $('.current.page').find('.caption') : $(elem)
|
|
|
|
|
|
2013-03-06 21:18:54 +04:00
|
|
|
if(elem.is('.image-fit-height, .image-fit, .image-with-caption')
|
|
|
|
|
|| elem.parents('.image-fit-height, .image-fit, .image-with-caption').length > 0){
|
2013-03-06 05:32:49 +04:00
|
|
|
|
|
|
|
|
// prevent doing anything in ribbon mode..
|
|
|
|
|
if(togglePageView('?') == 'off'){
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-06 16:47:38 +04:00
|
|
|
if(!elem.hasClass('caption')){
|
|
|
|
|
elem = elem.parents('.page').find('.caption')
|
2013-03-06 05:32:49 +04:00
|
|
|
}
|
|
|
|
|
|
2013-03-06 16:47:38 +04:00
|
|
|
// hide and do not show empty captions...
|
|
|
|
|
if(elem.text().trim() != ''){
|
|
|
|
|
elem.toggleClass('hidden')
|
|
|
|
|
} else {
|
|
|
|
|
elem.addClass('hidden')
|
|
|
|
|
}
|
2013-03-06 05:32:49 +04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-26 14:22:33 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* vim:set ts=4 sw=4 : */
|