# wsemi
A support package for web developer.

![language](https://img.shields.io/badge/language-JavaScript-orange.svg) 
[![npm version](http://img.shields.io/npm/v/wsemi.svg?style=flat)](https://npmjs.org/package/wsemi) 
[![Build Status](https://travis-ci.org/yuda-lyu/wsemi.svg?branch=master)](https://travis-ci.org/yuda-lyu/wsemi) 
[![license](https://img.shields.io/npm/l/wsemi.svg?style=flat)](https://npmjs.org/package/wsemi) 
[![gzip file size](http://img.badgesize.io/yuda-lyu/wsemi/master/dist/wsemi.umd.js.svg?compression=gzip)](https://github.com/yuda-lyu/wsemi)
[![npm download](https://img.shields.io/npm/dt/wsemi.svg)](https://npmjs.org/package/wsemi) 
[![jsdelivr download](https://img.shields.io/jsdelivr/npm/hm/wsemi.svg)](https://www.jsdelivr.com/package/npm/wsemi)

## Documentation
To view documentation or get support, visit [docs](https://yuda-lyu.github.io/wsemi/wsemi.html).

## Example
To view some examples for more understanding, visit examples:
> **lodash:** [ex-lodash.html](https://yuda-lyu.github.io/wsemi/examples/ex-lodash.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-lodash.html)]

> **dayjs:** [ex-dayjs.html](https://yuda-lyu.github.io/wsemi/examples/ex-dayjs.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-dayjs.html)]

> **dayjs:** [ex-timeTZ2expire-timeTZ2past.html](https://yuda-lyu.github.io/wsemi/examples/ex-timeTZ2expire-timeTZ2past.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-timeTZ2expire-timeTZ2past.html)]

> **cryptojs:** [ex-cryptojs.html](https://yuda-lyu.github.io/wsemi/examples/ex-cryptojs.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-cryptojs.html)]

> **fuzzball:** [ex-fuzzball.html](https://yuda-lyu.github.io/wsemi/examples/ex-fuzzball.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-fuzzball.html)]

> **fuzzball[dynamic import]:** [ex-fuzzball-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-fuzzball-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-fuzzball-dynamic.html)]

> **obj2u8arr & u8arr2obj:** [ex-tobj2u8arr-u8arr2obj.html](https://yuda-lyu.github.io/wsemi/examples/ex-tobj2u8arr-u8arr2obj.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-tobj2u8arr-u8arr2obj.html)]

> **colorConverter:** [ex-colorConverter.html](https://yuda-lyu.github.io/wsemi/examples/ex-colorConverter.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-colorConverter.html)]

> **uaparser:** [ex-uaparser.html](https://yuda-lyu.github.io/wsemi/examples/ex-uaparser.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-uaparser.html)]

> **uaparser[dynamic import]:** [ex-uaparser-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-uaparser-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-uaparser-dynamic.html)]

> **xss:** [ex-xss.html](https://yuda-lyu.github.io/wsemi/examples/ex-xss.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-xss.html)]

> **openlink:** [ex-openlink.html](https://yuda-lyu.github.io/wsemi/examples/ex-openlink.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-openlink.html)]

> **tippyjs[with popper.js]:** [ex-tippyjs.html](https://yuda-lyu.github.io/wsemi/examples/ex-tippyjs.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-tippyjs.html)]

> **xlsx:** [ex-xlsx.html](https://yuda-lyu.github.io/wsemi/examples/ex-xlsx.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-xlsx.html)]

> **xlsx[dynamic import]:** [ex-xlsx-dynamic](https://yuda-lyu.github.io/wsemi/examples/ex-xlsx-dynamic) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-xlsx-dynamic)]

> **viewerjs:** [ex-viewerjs.html](https://yuda-lyu.github.io/wsemi/examples/ex-viewerjs.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-viewerjs.html)]

> **viewerjs[dynamic import]:** [ex-viewerjs-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-viewerjs-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-viewerjs-dynamic.html)]

> **html2canvas:** [ex-html2canvas.html](https://yuda-lyu.github.io/wsemi/examples/ex-html2canvas.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-html2canvas.html)]

> **html2canvas[dynamic import]:** [ex-html2canvas-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-html2canvas-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-html2canvas-dynamic.html)]

> **html-to-image:** [ex-html-to-image.html](https://yuda-lyu.github.io/wsemi/examples/ex-html-to-image.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-html-to-image.html)]

> **html-to-image[dynamic import]:** [ex-html-to-image-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-html-to-image-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-html-to-image-dynamic.html)]

> **htmlparser:** [ex-htmlparser.html](https://yuda-lyu.github.io/wsemi/examples/ex-htmlparser.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-htmlparser.html)]

> **htmlparser[dynamic import]:** [ex-htmlparser-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-htmlparser-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-htmlparser-dynamic.html)]

> **scrollIntoView:** [ex-scrollIntoView.html](https://yuda-lyu.github.io/wsemi/examples/ex-scrollIntoView.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-scrollIntoView.html)]

> **scrollTo:** [ex-scrollTo.html](https://yuda-lyu.github.io/wsemi/examples/ex-scrollTo.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-scrollTo.html)]

> **domDropFiles:** [ex-domDropFiles.html](https://yuda-lyu.github.io/wsemi/examples/ex-domDropFiles.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-domDropFiles.html)]

> **domDrag:** [ex-domDrag.html](https://yuda-lyu.github.io/wsemi/examples/ex-domDrag.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-domDrag.html)]

> **domIsVisible:** [ex-domIsVisible.html](https://yuda-lyu.github.io/wsemi/examples/ex-domIsVisible.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-domIsVisible.html)]

> **domRipple:** [ex-domRipple.html](https://yuda-lyu.github.io/wsemi/examples/ex-domRipple.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-domRipple.html)]

> **tesseract.js:** [ex-tesseract.html](https://yuda-lyu.github.io/wsemi/examples/ex-tesseract.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-tesseract.html)]

> **tesseract.js[dynamic import]:** [ex-tesseract-dynamic.html](https://yuda-lyu.github.io/wsemi/examples/ex-tesseract-dynamic.html) [[source code](https://github.com/yuda-lyu/wsemi/blob/master/docs/examples/ex-tesseract-dynamic.html)]

## Installation
### Using npm(ES6 module):
> **Note:** wsemi is mainly dependent on `lodash`, `eventemitter3`, `crypto-js`, `dayjs`, `fuzzball`, `ua-parser-js`, `xss`, `xlsx`, `tesseract.js`, `htmlparser` and `tippy.js`.
```alias
npm i wsemi
```

### In a browser(UMD module):
> **Note:** umd file includes with `lodash`, `crypto-js` and `tippy.js`.

[Optional] Add script with nomodule for IE11.
```alias
<script nomodule src="https://cdn.jsdelivr.net/npm/@babel/polyfill@7.12.1/dist/polyfill.min.js"></script>
```

[Optional] Add script for dayjs(or moment).
> **Note:** Include script when using some function of time. If include `moment`, need set `moment` to `window.dayjs` (ex: `window.dayjs = moment`), and put it before include script for wsemi.umd.js.
```alias
<script src="https://cdn.jsdelivr.net/npm/dayjs@1.x/dayjs.min.js"></script>
```
or
```alias
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js"></script>
<script>
  window.dayjs = moment
</script>
```

[Optional] Add script for fuzzball.
> **Note:** Include script when using `strFindFuzz` function, and don't include script when using `strFindFuzzDyn` function.
```alias
<script src="https://cdn.jsdelivr.net/npm/fuzzball@2.x/dist/fuzzball.umd.min.js"></script>
```

[Optional] Add script for ua-parser-js.
> **Note:** Include script when using `getUserAgent` function, and don't include script when using `getUserAgentDyn` function.
```alias
<script src="https://cdn.jsdelivr.net/npm/ua-parser-js@0.7.28/dist/ua-parser.min.js"></script>
```

[Optional] Add script for xss.
> **Note:** Include script when using `clearXSS` function.
```alias
<script src="https://cdn.jsdelivr.net/npm/xss@1.0.9/dist/xss.min.js"></script>
```

[Optional] Add script for xlsx.
> **Note:** Include script when using `downloadExcelFileFromData` or `getDataFromExcelFileU8Arr` function, and don't include script when using `downloadExcelFileFromDataDyn` or `getDataFromExcelFileU8ArrDyn` function.
```alias
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.x/dist/xlsx.full.min.js"></script>
```

[Optional] Add link and script for viewerjs.
> **Note:** Include script when using `domShowImages` function, and don't include script when using `domShowImagesDyn` function.
```alias
<link href="https://cdn.jsdelivr.net/npm/viewerjs@1.10.1/dist/viewer.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/viewerjs@1.10.1/dist/viewer.min.js"></script>
```

[Optional] Add script for html2canvas.
> **Note:** Include script when using `html2pic` function, and don't include script when using `html2picDyn` function. Use canvg with nomodule for IE11.
```alias
<script nomodule src="https://cdn.jsdelivr.net/npm/canvg@3.0.7/lib/umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.3.2/dist/html2canvas.min.js"></script>
```

[Optional] Add script for html-to-image.
> **Note:** Include script when using `domConvertToPic` function, and don't include script when using `domConvertToPicDyn` function. html-to-image does not support IE11 and Safari.
```alias
<script src="https://cdn.jsdelivr.net/npm/html-to-image@1.7.0/dist/html-to-image.js"></script>
```

[Optional] Add script for htmlparser.
> **Note:** Include script when using `html2str` function, and don't include script when using `html2strDyn` function.
```alias
<script src="https://cdn.jsdelivr.net/npm/htmlparser@1.7.7/lib/htmlparser.min.js"></script>
```

[Optional] Add script for tesseract.js. It does not support IE11.
> **Note:** Include script when using `ocr` function, and don't include script when using `ocrDyn` function.
```alias
<script src="https://cdn.jsdelivr.net/npm/tesseract.js@2.1.5/dist/tesseract.min.js"></script>
```

[Necessary] Add script for wsemi.
```alias
<script src="https://cdn.jsdelivr.net/npm/wsemi@1.6.19/dist/wsemi.umd.js"></script>
```
