Logo Help Center

Introduction to the Elvis 4 JavaScript library

Introduction to the Elvis 4 JavaScript library

We have created an open-source JavaScript library to simplify building AJAX application in HTML that connect with the Elvis API. The library has classes that help out with most common tasks needed in HTML pages to show data from Elvis.

The library is based on the jQuery JavaScript library, making it easy to customize and extend. There is also a prototype-js based version of the samples in the 'prototype-js' branch in Github. The following paragraphs give a short description of the available classes.

  • ElvisAPI. This class provides a thin layer around commonly used REST API methods. It streamlines the authentication process and underlying AJAX calls so you can focus on coding your added functionality.
  • ElvisPlugin. This class provides utility methods for Elvis plug-ins, to give access to the elvisContext from the desktop client.
  • HitRenderer. This class simplifies creating HTML of the JSON search results received from the REST API. It can render HTML for hits, the amount of hits found, for a pager to navigate larger number of results and it can handle thumbnail clicks.

The HitRenderer API

  • FacetRenderer. This class simplifies creating HTML from the JSON search facets received from the REST API. It can render HTML for facets and it can add search parameters to filter on selected facets.

The FacetRenderer API

  • ColumnTree. This class renders a folder browser in HTML. It handles browsing through the Elvis folder structure similar to how this works in the Elvis desktop client. You can select folders and collections use the HitRenderer to display the assets contained in them.

The ColumnTree API

  • PreviewLightBox. This class shows a simple overlay over the page and displays the preview for a hit, it can display a preview in the full browser window, it can correctly display all preview types provided by Elvis and it can navigate back and forth between multiple previews.

The PreviewLightbox API

Where to get it

The JavaScript library is available on the open-source code collaboration platform GitHub with a number of API sample interfaces.

The JavaScript files and all associated CSS and images are located in the shared_resources/elvis_api folder.

How to contribute

We encourage everyone to share and contribute improvements or new samples with the Elvis community.

If you have experience with Git and GitHub, it is very easy to make contributions. You can fork the project, make your changes and then send us a pull request so we can review and add your improvements.

If you don't have experience with Git, you can just email patches or zip files to us and we will include them in the samples.

Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.