@dbmdz/mirador-sharebuttons

1.0.2 • Public • Published

Share buttons

NPM Maven Central

Provides functions for adding additional buttons that allow sharing content across different social media platforms.

NOTE: This plugin is just a library, it does nothing by just including it.

Installation

You can find production-ready build artifacts in the releases section.

Alternatively, you can use npm to install the artifacts:

$ npm install @dbmdz/mirador-sharebuttons

If you have a Java Web-Application managed with mvn, there is also a WebJar, which can be included as follows:

<dependency>
  <groupId>org.webjars.npm</groupId>
  <artifactId>dbmdz__mirador-sharebuttons</artifactId>
  <version>{set to current version}</version>
</dependency>

Usage

Including

Enable the plugin by including the CSS and the JavaScript (after loading Mirador):

<link rel="stylesheet" type="text/css" href="<url to the plugin>/shareButtons.min.css" />
...
<script src="<url to the plugin>/shareButtons.min.js"></script>

Provided functions

init(showExternalLinkInfo) → {void}

Registers some needed Handlebars helpers and sets a variable.

Parameters:

Name Type Description Default
showExternalLinkInfo Boolean Display an info that the website containing the Mirador instance is left by clicking on the share buttons false

injectButtonsToDom(targetSelector, position) → {void}

Injects the buttons to the target selector element in the given position.

Parameters:

Name Type Description Default
targetSelector String The selector for the element that should contain the buttons
position String The position of the buttons within the containing element "afterbegin"

updateButtonLinks(data) → {void}

Updates the button links with the given parameters.

Parameters:

Name Type Description
data Object The data for the links
data.attribution String The attribution of the link to share
data.label String The label of the link to share
data.link String The link itself
data.thumbnailUrl String The thumbnail url of the link to share

Readme

Keywords

Package Sidebar

Install

npm i @dbmdz/mirador-sharebuttons

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

13.1 kB

Total Files

7

Last publish

Collaborators

  • dbmdz-deployment
  • morpheus-87
  • marcus.bitzl
  • jbaiter