|
|
@ -5,9 +5,10 @@ Abbr is a JavaScript library / function for finding, highlighting and annotating |
|
|
|
|
|
|
|
|
|
|
|
It needs no extra markup, all is done automatically. Just tell it what words you want to explain, and it'll do it. |
|
|
|
It needs no extra markup, all is done automatically. Just tell it what words you want to explain, and it'll do it. |
|
|
|
|
|
|
|
|
|
|
|
Abbr takes the following arguments: |
|
|
|
Abbr takes the following (default) arguments: |
|
|
|
|
|
|
|
|
|
|
|
var opts = { |
|
|
|
```js |
|
|
|
|
|
|
|
{ |
|
|
|
// selector in which to search for abbreviations |
|
|
|
// selector in which to search for abbreviations |
|
|
|
where: 'body', |
|
|
|
where: 'body', |
|
|
|
// abbreviation list - word: explanation |
|
|
|
// abbreviation list - word: explanation |
|
|
@ -22,23 +23,28 @@ Abbr takes the following arguments: |
|
|
|
excluded: ['script', 'style', 'code', 'head', 'textarea', 'embed'], |
|
|
|
excluded: ['script', 'style', 'code', 'head', 'textarea', 'embed'], |
|
|
|
// Extra excluded (doesn't overwrite the original list) |
|
|
|
// Extra excluded (doesn't overwrite the original list) |
|
|
|
exclude: [] |
|
|
|
exclude: [] |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
All config options are optional (though, obviously, you don't want to leave `words` empty). |
|
|
|
All config options are optional (though, obviously, you don't want to leave `words` empty). |
|
|
|
|
|
|
|
|
|
|
|
To run it, simply call: |
|
|
|
To run it, simply call: |
|
|
|
|
|
|
|
|
|
|
|
abbr({ |
|
|
|
```js |
|
|
|
|
|
|
|
abbr({ |
|
|
|
// Your options here |
|
|
|
// Your options here |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
For example: |
|
|
|
For example: |
|
|
|
|
|
|
|
|
|
|
|
abbr({ |
|
|
|
```js |
|
|
|
|
|
|
|
abbr({ |
|
|
|
where: 'article', |
|
|
|
where: 'article', |
|
|
|
words: { |
|
|
|
words: { |
|
|
|
'NSA': 'National Spying Agency', |
|
|
|
'NSA': 'National Spying Agency', |
|
|
|
'Putin': 'Bear rider' |
|
|
|
'Putin': 'Bear rider' |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|