mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-29 03:00:09 +00:00
several minor tweeks and generalizations...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ba3efdb181
commit
f4be51c97b
11
lib/jli.js
11
lib/jli.js
@ -22,8 +22,8 @@
|
||||
// if class_list is a list, the resulting function understands the
|
||||
// folowing arguments:
|
||||
// - <index> : 0 for 'off' and 1 for 'on' (see below)
|
||||
// - 'on' : switch mode on
|
||||
// - 'off' : switch mode off
|
||||
// - 'on' : switch mode on -- add class
|
||||
// - 'off' : switch mode off -- remove class
|
||||
// - '?' : return current state ('on'|'off')
|
||||
// - no arguments : toggle the state
|
||||
//
|
||||
@ -33,10 +33,13 @@
|
||||
// - '?' : return current state ('on'|'off')
|
||||
// - no arguments : set next state in cycle
|
||||
//
|
||||
// NOTE: a special class name 'none' means no class is set, if it is present
|
||||
// in the class_list then that state will be with all other state
|
||||
// classes removed.
|
||||
// NOTE: <class-name> must be an exact match to a string given in class_list
|
||||
// NOTE: of only one callback is given then it will be called after the
|
||||
// class change...
|
||||
// a way around this is to pass an empty function as callback_b
|
||||
// class change...
|
||||
// a way around this is to pass an empty function as callback_b
|
||||
//
|
||||
function createCSSClassToggler(elem, class_list, callback_a, callback_b){
|
||||
var bool_action = false
|
||||
|
||||
@ -115,6 +115,8 @@ function updateView(){
|
||||
function isPageResizable(page){
|
||||
if(page == null){
|
||||
page = $('.current.page')
|
||||
} else {
|
||||
page = $(page)
|
||||
}
|
||||
if(!USE_REAL_PAGE_SIZES){
|
||||
return false
|
||||
@ -147,6 +149,8 @@ function isPageResizable(page){
|
||||
function getPageAlign(page){
|
||||
if(page == null){
|
||||
page = $('.current.page')
|
||||
} else {
|
||||
page = $(page)
|
||||
}
|
||||
|
||||
var mag = $('.magazine')
|
||||
@ -191,6 +195,8 @@ function getPageScale(){
|
||||
function getPageNumber(page){
|
||||
if(page == null){
|
||||
page = $('.current.page')
|
||||
} else {
|
||||
page = $(page)
|
||||
}
|
||||
return $('.page').index(page)
|
||||
}
|
||||
@ -1126,6 +1132,7 @@ JSONMetadata = {
|
||||
|
||||
|
||||
function readMetadata(elem, res, metadata){
|
||||
elem = $(elem)
|
||||
if(res == null){
|
||||
res = {}
|
||||
}
|
||||
@ -1144,6 +1151,7 @@ function readMetadata(elem, res, metadata){
|
||||
return res
|
||||
}
|
||||
function writeMetadata(elem, res, metadata){
|
||||
elem = $(elem)
|
||||
if(metadata == null){
|
||||
metadata = JSONMetadata
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user