/embaralha

Shuffles characters in given html element, then restores it's original text

Primary LanguageJavaScriptMIT LicenseMIT

embaralha

Shuffles characters in given html element, then restores it's original text. Embaralha means "to shuffle" in portuguese.

As you can observe in this GIF, I strongly recomend that you use a monospace font ;)

Instalation

npm i embaralha or just grab the index.js file.

Usage

If you want to shuffle the text in the mouseover event, you could do it like this:

import { embaralha } from 'embaralha';
const elem = document.querySelector('.your-embaralha-class');
elem.addEventListener('mouseover', async () => embaralha(elem, 1000));

Contributing

Any contribution is welcome, just make sure the tests (npm test) are passing, but don't worry about the webdriver tests (the ones in the test/specs dir). And if you'd be so kind, write your tests for your additions.

To Do

  • don't change char when white space ("respect the words")
  • bug fix when mouseover multiple times causing loss of orinal text
  • use webdriver properly
  • use eslint
  • lower the dist file size
  • add to microjs

License

MIT License found in LICENSE file.