feat: 3.0.4
This commit is contained in:
parent
8c2b021140
commit
6054686a01
|
@ -144,4 +144,9 @@
|
|||
|
||||
## 3.0.3
|
||||
1. 增加繁体字 裡迴讚
|
||||
2. 增加 draw 插件绘制控制api startAnimation pauseAnimation resumeAnimation drawNextStroke
|
||||
2. 增加 draw 插件绘制控制api startAnimation pauseAnimation resumeAnimation drawNextStroke
|
||||
|
||||
## 3.0.4
|
||||
1. 增加 将否 两个字的默认读音
|
||||
2. 修正 银行 词组的读音
|
||||
3. 修正了多个多音字和词组
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cnchar",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.4",
|
||||
"description": "功能全面、多端支持的汉字拼音笔画js库,支持多音字、繁体字、火星文",
|
||||
"main": "index.html",
|
||||
"author": "theajack <contact@theajack.com>",
|
||||
|
|
|
@ -144,4 +144,9 @@
|
|||
|
||||
## 3.0.3
|
||||
1. 增加繁体字 裡迴讚
|
||||
2. 增加 draw 插件绘制控制api startAnimation pauseAnimation resumeAnimation drawNextStroke
|
||||
2. 增加 draw 插件绘制控制api startAnimation pauseAnimation resumeAnimation drawNextStroke
|
||||
|
||||
## 3.0.4
|
||||
1. 增加 将否 两个字的默认读音
|
||||
2. 修正 银行 词组的读音
|
||||
3. 修正了多个多音字和词组
|
|
@ -2,11 +2,11 @@
|
|||
/**
|
||||
* Event BUS
|
||||
*/
|
||||
let events = {};
|
||||
let EVENT = {};
|
||||
const events = {};
|
||||
const EVENT = {};
|
||||
|
||||
let isUndf = (v) => {return typeof v === 'undefined';};
|
||||
let isObject = (v) => {return typeof v === 'object';};
|
||||
const isUndf = (v) => {return typeof v === 'undefined';};
|
||||
const isObject = (v) => {return typeof v === 'object';};
|
||||
|
||||
export function checkEvent (name) {
|
||||
if (events[name]) {
|
||||
|
@ -25,7 +25,7 @@ function init (name) {
|
|||
|
||||
function regist (name, listener) {
|
||||
if (isObject(name)) {
|
||||
for (let key in name) {
|
||||
for (const key in name) {
|
||||
regist(key, name[key]);
|
||||
}
|
||||
return;
|
||||
|
@ -45,7 +45,7 @@ function remove (name, listener) {
|
|||
console.error('请传入要移除的listener');
|
||||
return false;
|
||||
} else {// 移除单个监听
|
||||
let index = events[name].listeners.indexOf(listener);
|
||||
const index = events[name].listeners.indexOf(listener);
|
||||
if (index === -1) {
|
||||
console.warn('removeEvent:未找到监听函数 ' + name);
|
||||
return false;
|
||||
|
|
|
@ -4,7 +4,7 @@ let jsbox = null;
|
|||
|
||||
function getUrl () {
|
||||
let url = '';
|
||||
let host = window.location.host;
|
||||
const host = window.location.host;
|
||||
if (host.indexOf('localhost') !== -1 || host === 'theajack.gitee.io') {
|
||||
url = 'https://theajack.gitee.io';
|
||||
} else {
|
||||
|
@ -19,9 +19,9 @@ function main () {
|
|||
}
|
||||
hackConsole();
|
||||
initStyle();
|
||||
let mask = initDom();
|
||||
let iframe = mask.querySelector('.jsbox-iframe');
|
||||
let closeIcon = mask.querySelector('.jsbox-close');
|
||||
const mask = initDom();
|
||||
const iframe = mask.querySelector('.jsbox-iframe');
|
||||
const closeIcon = mask.querySelector('.jsbox-close');
|
||||
function open () {
|
||||
mask.style.display = 'block';
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
@ -67,7 +67,7 @@ function main () {
|
|||
}
|
||||
|
||||
function hackConsole () {
|
||||
let log = console.log;
|
||||
const log = console.log;
|
||||
console.log = (...arg) => {
|
||||
event.emit('onlog', arg);
|
||||
log(...arg);
|
||||
|
@ -75,7 +75,7 @@ function hackConsole () {
|
|||
}
|
||||
|
||||
function initDom () {
|
||||
let mask = document.createElement('div');
|
||||
const mask = document.createElement('div');
|
||||
mask.className = 'jsbox-mask';
|
||||
mask.innerHTML = /* html*/`
|
||||
<div class='jsbox-header'>
|
||||
|
@ -89,7 +89,7 @@ function initDom () {
|
|||
}
|
||||
|
||||
function initStyle () {
|
||||
let style = document.createElement('style');
|
||||
const style = document.createElement('style');
|
||||
style.innerText = /* css*/`
|
||||
.jsbox-mask{
|
||||
position: fixed;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export function extractScript (html) {
|
||||
let reg = /<script(.|\n)*?>(.|\n)*?<\/script>/g;
|
||||
let arr = html.match(reg);
|
||||
const reg = /<script(.|\n)*?>(.|\n)*?<\/script>/g;
|
||||
const arr = html.match(reg);
|
||||
if (!arr) {
|
||||
return {html, js: ''};
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ export function parseUrlParam (search, name, defVal) {
|
|||
}
|
||||
if (typeof name !== 'undefined') {
|
||||
if (search !== '') {
|
||||
let reg = new RegExp('(^|&)' + name + '=([^&]*?)(&|$)', 'i');
|
||||
let r = search.substr(1).match(reg);
|
||||
const reg = new RegExp('(^|&)' + name + '=([^&]*?)(&|$)', 'i');
|
||||
const r = search.substr(1).match(reg);
|
||||
if (r != null) {
|
||||
return unescape(r[2]);
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ export function parseUrlParam (search, name, defVal) {
|
|||
return (typeof defVal !== 'undefined') ? defVal : null;
|
||||
}
|
||||
if (search === '') { return {}; }
|
||||
let arr = search.substr(1).split('&');
|
||||
let param = {};
|
||||
const arr = search.substr(1).split('&');
|
||||
const param = {};
|
||||
arr.forEach(item => {
|
||||
let pArr = item.split('=');
|
||||
const pArr = item.split('=');
|
||||
param[pArr[0]] = pArr[1];
|
||||
});
|
||||
return param;
|
||||
|
|
Loading…
Reference in New Issue