# jmentions

> Mention people like facebook and asana.

Latest version **1.0.0** (published 2016-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install jmentions
pnpm add jmentions
yarn add jmentions
bun add jmentions
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-06-27 |
| First published | 2016-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Igor Corradi |
| Maintainers | icorradi |
| Keywords | mentions, mention, people, facebook, asana, jquery-plugin |

## Links

- npm: https://www.npmjs.com/package/jmentions
- Repository: https://github.com/icorradi/jMentions
- Homepage: https://github.com/icorradi/jMentions#readme
- Issues: https://github.com/icorradi/jMentions/issues
- npm.io page: https://npm.io/package/jmentions

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-06-27

## README

# jMentions - jQuery Plugin
Mention people like Facebook and Asana

> This plugin is designed to be used with **contenteditable**.

### Example
[Demo](http://icorradi.github.io/jmentions)

![gif demo](https://github.com/icorradi/jMentions/blob/master/demo.gif "GIF Demo")

### How to use:
Add a tag with contenteditable attribute on HTML
```html
<div id="editable" class="editable1" contenteditable="true"></div>
```

After include jQuery and jMentions call the plugin with the following syntax
```javascript
$('#editable').jMentions({
  source: function(prefix) {
    /* prefix: it's the current value that was matched when '@' was mentioned
       Example: Hello, @jho...
       prefix: "jho"

       This is util to API with autocomplete
    */

    return $.get('users.json', function(data) {
      /* [
           {"value": "jhon", "label": "Jhon", "avatar": "pic.jpg"},
           {"value": "maria", "label": "Maria", "avatar": "pic.jpg"},
           {"value": "alex", "label": "Alex", "avatar": "pic.jpg"}
         ]
       */
      return data;
    })
  },
  value: 'username', // default is 'value'
  label: 'name', // default is 'label'
  avatar: 'user-pic', // default is 'avatar'
  dropdownClass: 'myDropdown' // default is 'jmentions-dropdown'
});

/* Example to get mentions results */
$('#results-button').click(function() {
  console.log($.jMentions.getResults('.editable1'));
})
```

 - **source:** This function receives the prefix and returns a list of matches
 - **value:** Field name to get "value" from data
 - **label:** Field name to get "label" from data
 - **avatar:** Field name to get "avatar" from data
 - **dropdownClass:** Class name for dropdown

### License

The MIT License (MIT)
Copyright © 2016 Igor Corradi <igorcorradi.dev@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
_Source: https://npm.io/package/jmentions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
