A simple chrome extension that counts the number of words in a highlighted paragraph.
- JavaScript
- Chrome Extension API
- Download and install the extension from the Chrome Web Store.
- Browse to any website.
- Highlight a paragraph of text.
- The number of words in the highlighted text will be displayed in an alert box.
The extension uses a content script that listens for a "mouseup" event on the document, which is fired when the user releases the mouse button after highlighting text. The content script then gets the selected text using window.getSelection().toString()
and counts the number of words in the selected text using split(/\s+/)
and counting the number of items in the resulting array.
- Clone the repository
git clone https://github.com/mo-root/Word_counter_extesnsion.git
- Go to chrome://extensions/ and check the box for Developer mode in the top right.
- Click the "Load unpacked" button and select the cloned folder
- Fork the repository
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request