JavaScript Interface


Initialization:
FSIThumbBar = new $FSI.FSIThumbBar ();
FSIThumbBar.init(dir:"images/foo");


Public Methods


void

init(elementID, oParameters, bDebug);


Initializes the FSI ThumbBar instance with the given parameters.


void

printAPI();


Shows all API methods in the console in alphabetical order.


void

destroy();


Destroys the FSI ThumbBar instance leaving the empty container <div> only. You can re-use the same container calling FSIThumbBar.init()


bInitDone

getInitDone();


Returns if the initialization process is done.


nInstanceID

getInstanceID();


Returns the number of the viewer object.


strVersion

getVersion();


Returns a string containing the FSI ThumbBar software version.


strBuild

getBuild();


Returns a string containing the FSI ThumbBar software build number.


void

assignFSIViewer(iFSIViewerInstance);


Assigns a certain FSI Viewer JS instance to FSI ThumbBar for building FSI Showcase JS.


void

focusImage(nImage);


Scrolls the bar until the image with the given index is in the foreground.


void

zoomImage(nImage);


Scrolls the bar until the image with the given index is in the foreground and zoom the given image afterwards.


void

closeZoom(evt, bImmediate);


Remove the zoomed image if any.


bSuccess

addListener(strListenerName, fn, iScope);


Calls a specific listener.


bSuccess

removeListener(strListenerName, fn);


Removes a specific listener.


void

dumpListeners();


Dumps all listeners.


strInstanceName

getInstanceName();


Returns the name of the viewer object.


void

testAPIListenersStart()


Starts the API test and shows all called listeners and the parameters which they return.


void

testAPIListenersStop()


Stops the API test.


bSuccess

buttonDown(strCommand)


Presses the down button.


bSuccess

buttonUp(strCommand)


Presses the up button.


bSuccess

changeConfig(strCfgFileName, oParameters)


Reset the viewer object and change the configuration to the given configuration file.

strCfgFileName (optional): path to the configuration file (see "cfg" parameter)

oParameters (optional): an object containing parameters If present, these parameters will overwrite the parameters defined upon initialization.


bSuccess

changeDir(strDirectory)


Reset the viewer object changes the directory to the given directory.


void

firstImage(nAnimationFrames)


Selects the first image of the range.


void

addImages(arPathsOrObjects )


Adds images to FSI ThumbBar.


void

removeImages(arIndice)


Removes certain images.


void

removeAllImages(bSuccess)


Removes all images.


mixed

getConfigValue(strName)


Returns the set config value for the given parameters.


nImages

getImageCount()


Returns the amount of images used in FSI ThumbBar.


oParameters

getParameters()


Returns the current parameters used in FSI ThumbBar.


nIndex

getCurrentImageIndex()


Returns the current image index.


fPosition

getScrollPos()


Returns the current scroll position.


bScrolling

isScrolling()


Returns if FSI ThumbBar is currently scrolling.


void

lastImage(nAnimationFrames )


Selects the last image of the range.


void

nextImage(nAnimationFrames )


Selects the next image of the range.


void

nextPage(nAnimationFrames )


Selects the next pages of the range.


void

previousImage(nAnimationFrames )


Selects the previous image of the range.


void

previousPage(nAnimationFrames )


Selects the previous page of the range.


bSuccess

registerButton(DOMElement, strCommand)


Registers a button with the given specifications. (See Adding Control Buttons.)


fPosition

setScrollPos(fPosition, nAnimationFrames)


Sets the scroll position based on the given specifications


void

startAutoRotate(fSpeed )


Starts the automatic rotation.


void

stopAutoRotate()


Stops the automatic rotation.


void

traceConfigValue(strName )


Traces a config value and enables you to see where (in config files, the _default.xml, etc) a specific value is set.


bSuccess

unRegisterButton(DOMElement )


Unregisters a button. (See Adding Control Buttons.)




Callback functions


The optional JavaScript callback functions enables developers to react on events fired by FSI ThumbBar. To use a callback you need to implement a corresponding JavaScript function AND pass the name of the callback function to the FSI ThumbBar instance, e.g.:



Example:
function onStart(strDirectory, nImages, arImagePaths){
	console.log("The FSI ThumbBar instance with the id " + idElement 
	+ " displays a total of " + nImages + " images".} 


FSIThumbBar = new $FSI.ThumbBar();

FSIThumbBar.init(dir:"images/foo", callBackStart:onStart);



Note:

You can either pass the function or the function name in window scope as a string.



The following callback functions can be used:


onStart(strDirectory, nImages, arImagePaths);


Called once after loading the image list.



onClick(nIndex, oItem);


Called each time the user clicks an image.



onReady();


Called as soon as the viewer finished loading data and gets interactive.



onFocus(nImageIndex, strImagePath);


Called each time the foreground image changes.



onZoomReady(nImageIndex,strImageURL,elZoomedImage );


Called as soon as the zoom is ready.



onZoomStart(nImageIndex, strImageURL);


Called each time a zoomed image starts loading.



onZoomEnd();


Called each time a zoomed image has been closed.



onDestroy();


Called as soon as the viewer is destroyed.



onInit(oParameters);


Called as soon as the viewer is initialized.



onConfigsReady(oConfigValues);


Called as soon as the config is ready.


onChangeConfig(strCfgFileName, oParameters);


Called as soon as the config is changed.


onResize(oConfigValues);


Called as soon as the instance is resized.


onMetaData(oItem, oMetaData);


Called as soon as the meta data is loaded.



onReplaceTemplateValue(name, value);


Returns: newValue.

Calles as soon as the Label Template is replaced.


onBeforeReplaceLabelTemplates(strLabel, oItem);


Returns: strNewLabel.

Calles directly before the Label Template is replaced.



onAfterReplaceLabelTemplates(strLabel, oItem);


Returns: strNewLabel.

Calles directly after the Label Template is replaced.



onMouseEnter(nIndex, oItem);


Called as soon the mouse enters the defined area.



onMouseLeave(nIndex, oItem);


Called as soon the mouse leaves the defined area.



onScrollStart(fPosition);


Called as soon as the scrolling is started.



onScrollEnd(fPosition);


Called as soon as the scrolling is ended.



onSetScrollRange(fTotalSize, fRange, bEndlessScrolling, nTotalImages);


Called as soon as the defined scroll range is set.


FSI ThumbBar JavaScript Interface