Coder Social home page Coder Social logo

js-vcr-integration's Introduction

Javascript library for Virtual Collection Registry integrations

Widget and API for easy integration with the Virtual Collection Registry (VCR)

Build and test workflow Documentation

Main features

  • Queueing of items (with URL/PID, title and description) for submission to the VCR
  • Submission queue component with listing and submit, clear, hide/show controls
  • Declarative integration (no custom JS code required)
  • Optional programmatic control of queue and queue component
  • Style can be partially or fully overridden

Usage

Load the script in the <head> section of an HTML document:

<script type="text/javascript" defer="defer" src="https://collections.clarin.eu/script/vcr-integration/v1/vcr-integration.js"></script>

Define and annotate links for adding items to the queue:

Some resource
    (<a  data-vcr-uri="http://doi.org/10.5555/12345678" 
    data-vcr-label="Some resource">Add to virtual collection</a>)
(...)
Other resource 
    (<a  data-vcr-uri="https://tinyurl.com/my-resource" 
    data-vcr-label="Some other resource"
    data-vcr-description="Optional description for the resource">Add to virtual collection</a>)

That is it. If a user clicks one of the annotated links a queue component will appear, allowing the user to manage the queue (i.e. remove items or clear the entire queue) and eventually submit the queue to the Virtual Collection Registry.

Programmatic control

After initalisation, a control object becomes available as window.vcrIntegration. It exposes an API that is separately documented. Actions include queue item addition and removal, hiding and showing of the queue component, and changing any of the configuration properties (see below).

Configuration

Optionally a configuration object can be defined in the <head> section and made available for use by the library by assigning it to window.vcrIntegrationConfiguration:

<script script type="text/javascript">
    window.vcrIntegrationConfiguration = {
        'queueControlPosition': 'bottom-right'
    };
</script>

The follow properties are supported:

  • logLevel: Log level for console output
    • Value must be one of debug, info, warn or silent; see loglevel
    • Defaults to info
  • autoInitialize: Set to false to disable automatic initialisation of the plugin
    • Doing this renders the plugin inactive until programatically activated with a call to window.initVcrIntegration()
    • Defaults to true
  • endpointUrl: Base URL of the Virtual Collection endpoint
    • Defaults to https://collections.clarin.eu/submit/extensional
  • queueControlPosition: Position for rendering the queue component
    • One of top-right, bottom-right, bottom-left or top-left
    • Defaults to bottom-right
  • defaultName: Default name for a new collection
    • Leave unconfigured for no default name
  • icons: Can be used to pass an array that defines markup for icons to replace the default icons. See Icons.js for a list of properties.
  • autoDisableAddedItemLinks: ..
  • customQueueComponentClass: ..

Customisation

CSS

*TODO*

Icons

*TODO*

js-vcr-integration's People

Contributors

twagoo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.