https://github.com/up9cloud/js-zh2py
https://github.com/up9cloud/js-zh2py
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/up9cloud/js-zh2py
- Owner: up9cloud
- Created: 2016-06-25T12:37:33.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T03:21:10.000Z (over 7 years ago)
- Last Synced: 2025-03-22T21:20:02.479Z (about 1 year ago)
- Language: JavaScript
- Size: 85 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jquery.Zh2Py.min.js
不知原作者是誰,所以改寫下。希望能找到原作者。
- 原本是遍歷搜尋,為了以後著想還是改成字對音。
## usage
###### browser (jquery)
```js
(function (jQuery) {
const zh2py = require('zh2py');
// bind toPinyin to jquery.
jQuery.fn.toPinyin = function (h) {
const source = jQuery(this).text();
return zh2py(source);
};
})(jQuery);
$('text-div-id').toPinyin();
```
###### browser
```js
const zh2py = require('zh2py');
console.log(zh2py('芭樂'));
// Ba 樂
console.log(zh2py('芭樂', '*'));
// Ba *
```
## dev
- `npm install -g gulp`
- `npm install`
### build
```sh
gulp build
```
### test
```sh
./docker.run.sh
# open browser
# localhost/test/index.html
```