Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EvandroLG/selecting
:fishing_pole_and_fish: A library that allows you to access the text selected by the user
https://github.com/EvandroLG/selecting
javascript selecting
Last synced: 3 months ago
JSON representation
:fishing_pole_and_fish: A library that allows you to access the text selected by the user
- Host: GitHub
- URL: https://github.com/EvandroLG/selecting
- Owner: EvandroLG
- Created: 2014-12-29T01:00:55.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-22T18:57:17.000Z (about 9 years ago)
- Last Synced: 2024-07-11T07:57:34.074Z (4 months ago)
- Topics: javascript, selecting
- Language: JavaScript
- Homepage:
- Size: 331 KB
- Stars: 92
- Watchers: 4
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-javascript - selecting - A library that allows you to access the text selected by the user - ★ 69 (String)
README
# selecting
A library that allows you to access the text selected by the user.## Instalation
To install Selecting, execute:```shell
npm install selecting
```Or Bower too:
```shell
bower install selecting
```Or simply pick up the file from src directory.
## Supported Browsers
* Google Chrome
* Firefox
* Internet Explorer 9.0+
* Safari
* Opera
* iOS
* Android## How to use?
Selecting doesn't depend on jQuery, Zepto or any other library to work. You need just to include it at the end of your HTML code:```html
```Then you can call
window.selecting
function passing two parameters: an DOM element (jQuery object or NodeList) to listen to and a callback function that receive a [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Window.getSelection) object by parameter. For example:```js
window.selecting($('.container'), function(selector) {
// Properties
selector.text; // The selected text
selector.wordCount; // The number of words selected
});
```## Example
[See a simple example](http://evandrolg.github.io/selecting).## Contributors
|[![@evandrolg](https://avatars3.githubusercontent.com/u/444054?v=3&s=96)](https://github.com/evandrolg)|[![@felquis](https://avatars2.githubusercontent.com/u/736728?v=3&s=96)](https://github.com/felquis)|[![@gibatronic](https://avatars0.githubusercontent.com/u/819643?v=2&s=96)](https://github.com/gibatronic)|
|:---:|:---:|:---:|
|[@evandrolg](http://www.github.com/evandrolg)|[@felquis](http://www.github.com/felquis)|[@gibatronic](http://www.github.com/gibatronic)|