Methods
// create the FSI Pages Element and set parameters
const instance = document.createElement("fsi-pages")
instance.setAttribute("id", 'myPages')
instance.setAttribute("dir", "images/samples/catalogue/")
instance.setAttribute("skin", "white")
instance.setAttribute("pageLayout", "flip")
instance.setAttribute("listTemplate", "image_list")
instance.setAttribute("plugins", "resize,fullScreen, bookmarks")
instance.setAttribute("debug", true)
instance.style.width = '600px'
instance.style.height = '400px'
document.body.appendChild(instance)
// start Pages instance
instance.start()
// example method toggling the page index
setTimeout(() => {
instance.togglePageIndex()
}, 500)
// example listener which is called when a bookmark is added
const success = instance.addListener('onBookmarkAdded', (page) => {
console.log('Bookmark to page #', page, 'added.')
})
addListener
const success = addListener(listenerName, fn, iScope)
const success = instance.addListener('onPageChanged',
(page, pageStr, maxPage) => {
// code
})
Consult Callbacks for an overview of all available listeners.
changeConfig
changeConfig(cfgFileName, [parameters])
instance.changeConfig('viewer_presets/no_user_interface.xml')
clickMenuButton
clickMenuButton(buttonID)
See Overview of button IDs for FSI Pages for a list of all available IDs.
instance.clickMenuButton('ToggleFullScreen')
debugEnabled
const success = debugEnabled()
const success = instance.debugEnabled()
debugError
debugError()
instance.debugError()
debugLog
debugLog()
instance.debugLog()
debugWarn
debugWarn()
instance.debugWarn()
dumpListeners
dumpListeners()
instance.dumpListeners()
getBuild
const version = getBuild()
const version = instance.getBuild()
getConfigBoolean
const result = getConfigBoolean(paramName, default)
const result = instance.getConfigBoolean('blankBackCover', default)
getConfigFloat
const result = getConfigFloat(paramName, default)
const result = instance.getConfigFloat('dropShadowOpacity', default)
getConfigInt
const result = getConfigInt(paramName, default)
const result = instance.getConfigInt('thumbSize', default)
getConfigString
const result = getConfigString(paramName, default)
const result = instance.getConfigString('pageLayout', default)
getConfigValue
const value = getConfigValue(name)
const value = instance.getConfigValue('dir')
getContentID
const content = getContentID()
const content = instance.getContentID()
getContentID
const page = getCurrentPageNumber()
const page = instance.getCurrentPageNumber()
getInitDone
const success = getInitDone()
const success = instance.getInitDone()
getInstanceID
const getID = getInstanceID()
const getID = instance.getInstanceID()
getInstanceName
const name = getInstanceName()
const name = instance.getInstanceName()
getMenuButtonPresent
const success = getMenuButtonPresent(buttonID)
See Overview of button IDs for FSI Pages for a list of all available IDs.
This can be used to remove inactive buttons from the menu if you are using a custom skin.
Method only delivers correct results after the callback onInitMenu
is called.
const success = instance.getMenuButtonPresent('HotSpots')
getPageContainerDim
const dimension = getPageContainerDim()
const dimension = instance.getPageContainerDim()
getPageLayoutData
const layout = getPageLayoutData()
const layout = instance.getPageLayoutData()
// return example:
/*
{
"nMinPage": 1,
"nMaxPage": 14,
"nImages": 14,
"bDoublePages": true
}
*/
getPageNumberString
const page = getPageNumberString()
const name = instance.getInstanceName()
getParameters
const param = getParameters()
const param = instance.getParameters()
// return example:
/*
{
blankbackcover: "true"
debug: "true"
dir: "images/samples/pages/travel"
dropshadowopacity: "0.3"
height: "450px"
id: "myPages"
listtemplate: "catalog_list"
pagelayout: "flip"
plugins: "resize,fullScreen,chapters"
skin: "dark.css"
style: "width: 100%; height: 450px;"
width: "100%"
}
*/
getPluginParameter
const param = getPluginParameter(pluginName, parameterName, [defaultValue], [makeBoolean])
const param = instance.getPluginParameter('PagesThumbBar', 'pageNumbers')
See Plugin Parameters for an overview of all available plugins for FSI Pages.
getSkinClassName
const skin = getSkinClassName()
const skin = instance.getSkinClassName()
getTargetPage
const page = getTargetPage(page)
const page = instance.getTargetPage(6)
getVersion
const version = getVersion()
const version = instance.getVersion()
gotoPageAndZoom
gotoPageAndZoom(page, view)
instance.gotoPageAndZoom(12,'0.26304,0.10011,0.94325,0.64111')
gotoPageNumeric
gotoPageNumeric(page, animate)
instance.gotoPageNumeric(10)
hideMenuToolTip
hideMenuToolTip()
instance.hideMenuToolTip()
init
const success = init(id, options, debug)
This method is only needed if an FSI Pages has not been started automatically (default).
const success = instance.init('fsi-123', {
skin: 'dark',
pageLayout: 'flip',
blankBackCover: true
}, true)
makeBoolean
const success = makeBoolean(value, [defaultValue])
Example: 0, "0", "false" and "FALSE" are converted to boolean false. Every number except 0, "1", "true" and "TRUE" are converted to boolean true.
const success = instance.makeBoolean('false')
pressMenuButton
pressMenuButton(buttonID)
See Overview of button IDs for FSI Pages for a list of all available IDs.
instance.pressMenuButton('ToggleFullScreen')
printAPI
printAPI()
instance.printAPI()
registerExternalMenuButton
registerExternalMenuButton(button, buttonID, [tip])
See Overview of button IDs for FSI Pages for a list of all available IDs.
instance.registerExternalMenuButton('zoomIt', 'ZoomIn', 'It zooms!')
registerExternalMenuButtonsFromContainer
registerExternalMenuButtonsFromContainer(container)
instance.registerExternalMenuButtonsFromContainer('buttonContainer')
releaseMenuButton
releaseMenuButton(buttonID)
See Overview of button IDs for FSI Pages for a list of all available IDs.
instance.releaseMenuButton('ToggleFullScreen')
removeListener
const success = removeListener(listenerName, fn)
const success = instance.removeListener('onMenuDestroy', yourFunction)
searchForString
const success = searchForString(keyWords)
const success = instance.searchForString('example key words')
setFullScreenElement
const success = setFullScreenElement(FSContainer)
const success = instance.setFullScreenElement('buttonContainer')
showMenuToolTip
showMenuToolTip(tip, src, x, y)
instance.showMenuToolTip('foo', btn, 0, 0)
showSearchDialog
const success = showSearchDialog(show)
const success = instance.showSearchDialog(true)
testAPIListenersStart
testAPIListenersStart()
instance.testAPIListenersStart()
testAPIListenersStop
testAPIListenersStop()
instance.testAPIListenersStop()
traceConfigValue
const show = traceConfigValue(strName)
const show = instance.traceConfigValue('skin')
// return example:
/*
Tracing parameter "skin"
> [..]/_default.xml
<Options>
<Skin value="black"></Skin>
> By Parameter/Attribute:
dark.css
> RESULT:
skin = "dark.css"
*/
unregisterExternalMenuButton
const success = unregisterExternalMenuButton(button)
const success = instance.unregisterExternalMenuButton('zoomIt')
unregisterExternalMenuButtonsFromContainer
unregisterExternalMenuButtonsFromContainer(container)
instance.unregisterExternalMenuButtonsFromContainer('buttonContainer')