Simple script to add word definitions to your text content
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
defineme.js

README.md

defineme.js (inspired by hijs) is a simple script to add word definitions from external service to your text content.

Usage

Imagine you have a text on Einstein & physics and you want to add relevant links to wikipedia on a few words. To do that add at the end of your html body the configuration and the embedded script like so:

<script>
    window.defineme = {selector: 'p', url: 'http://en.wikipedia.org/wiki/%s', words: 'einstein physics cosmology'}
</script>

and straight after

<script src="defineme.js"></script>

Configuration

The defineme global object contains three parameters for configuration.

  • selector: name of the HTML tag(s) element(s) where the content will be parsed
  • url: existing url for dictionnary or encyclopedical service. The token %s is will be replaced by the word for its definition
  • words: space separated list of words that will be linked to external service

Exemples of url for external services for word definitions are: