@10yun/cv-mobile-ui 0.5.8 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/extend/permission.js +1 -2
  2. package/package.json +1 -1
  3. package/plugins/uni-richText.js +1 -1
  4. package/plugins/uni-socket.js +6 -8
  5. package/ui-cv/cv-editor-parse/components/wxParseAudio.vue +14 -5
  6. package/ui-cv/cv-editor-parse/components/wxParseImg.vue +26 -36
  7. package/ui-cv/cv-editor-parse/components/wxParseTable.vue +7 -7
  8. package/ui-cv/cv-editor-parse/components/wxParseTemplate0.vue +105 -88
  9. package/ui-cv/cv-editor-parse/components/wxParseTemplate1.vue +96 -88
  10. package/ui-cv/cv-editor-parse/components/wxParseTemplate10.vue +95 -88
  11. package/ui-cv/cv-editor-parse/components/wxParseTemplate11.vue +84 -82
  12. package/ui-cv/cv-editor-parse/components/wxParseTemplate2.vue +95 -88
  13. package/ui-cv/cv-editor-parse/components/wxParseTemplate3.vue +95 -88
  14. package/ui-cv/cv-editor-parse/components/wxParseTemplate4.vue +95 -88
  15. package/ui-cv/cv-editor-parse/components/wxParseTemplate5.vue +95 -88
  16. package/ui-cv/cv-editor-parse/components/wxParseTemplate6.vue +95 -88
  17. package/ui-cv/cv-editor-parse/components/wxParseTemplate7.vue +95 -88
  18. package/ui-cv/cv-editor-parse/components/wxParseTemplate8.vue +95 -88
  19. package/ui-cv/cv-editor-parse/components/wxParseTemplate9.vue +95 -88
  20. package/ui-cv/cv-editor-parse/components/wxParseVideo.vue +15 -15
  21. package/ui-cv/cv-editor-parse/cv-editor-parse.vue +1 -3
  22. package/ui-cv/cv-editor-parse/libs/html2json.js +15 -18
  23. package/ui-cv/cv-editor-parse/libs/htmlparser.js +12 -5
  24. package/ui-cv/cv-editor-parse/libs/wxDiscode.js +1 -1
  25. package/ui-cv/cv-editor-parse/readme.md +6 -0
  26. package/ui-cv/cv-editor-parse/u-parse.css +52 -95
  27. package/ui-cv/cv-geo-local/cv-geo-local.vue +0 -1
  28. package/ui-cv/cv-layout-topbar/cv-layout-topbar.vue +238 -0
  29. package/ui-cv/cv-markdown-show/cv-markdown-show.vue +109 -0
  30. package/ui-cv/cv-markdown-show/lib/highlight/atom-one-dark.css +1 -0
  31. package/ui-cv/cv-markdown-show/lib/highlight/atom-one-light.css +1 -0
  32. package/ui-cv/cv-markdown-show/lib/highlight/github-dark.min.css +10 -0
  33. package/ui-cv/cv-markdown-show/lib/highlight/uni-highlight.min.js +9122 -0
  34. package/ui-cv/cv-markdown-show/lib/html-parser.js +352 -0
  35. package/ui-cv/cv-markdown-show/lib/markdown-it.min.js +2 -0
  36. package/ui-cv/cv-markdown-show/markdown.css +340 -0
  37. package/ui-cv/cv-markdown-show/package.json +18 -0
  38. package/ui-cv/cv-markdown-show/readme.md +45 -0
  39. package/ui-cv/cv-nav-col/cv-nav-col.vue +2 -1
  40. package/ui-sdks/sdk-app-update/img/logo.png +0 -0
  41. package/ui-sdks/sdk-app-update/img/update_bg.png +0 -0
  42. package/ui-sdks/sdk-app-update/img/update_bg_top.png +0 -0
  43. package/{ui-cv/cv-update-app/cv-update-app.vue → ui-sdks/sdk-app-update/sdk-app-update.vue} +2 -2
  44. package/ui-sdks/sdk-app-update/xxxx +62 -0
  45. package/ui-sdks/sdk-privacy-policy/sdk-privacy-policy.vue +113 -0
  46. package/ui-sdks/sdk-u-charts/app-echarts.min.js +23 -0
  47. package/ui-sdks/sdk-u-charts/config-echarts.js +420 -0
  48. package/ui-sdks/sdk-u-charts/config-ucharts.js +630 -0
  49. package/ui-sdks/sdk-u-charts/h5-echarts.min.js +23 -0
  50. package/ui-sdks/sdk-u-charts/u-charts.js +7398 -0
  51. package/ui-sdks/sdk-u-charts/u-charts.min.js +1 -0
  52. package/ui-sdks/sdk-webview-main/WebViewMain.vue +1 -0
  53. package/ui-sdks/sdk-webview-main/main.js +0 -0
  54. package/ui-sdks/sdk-webview-main/mixin.js +0 -0
  55. package/ui-uni/uParse/src/components/wxParseAudio.vue +26 -0
  56. package/ui-uni/uParse/src/components/wxParseImg.vue +94 -0
  57. package/ui-uni/uParse/src/components/wxParseTable.vue +55 -0
  58. package/ui-uni/uParse/src/components/wxParseTemplate0.vue +103 -0
  59. package/ui-uni/uParse/src/components/wxParseTemplate1.vue +88 -0
  60. package/ui-uni/uParse/src/components/wxParseTemplate10.vue +88 -0
  61. package/ui-uni/uParse/src/components/wxParseTemplate11.vue +86 -0
  62. package/ui-uni/uParse/src/components/wxParseTemplate2.vue +88 -0
  63. package/ui-uni/uParse/src/components/wxParseTemplate3.vue +88 -0
  64. package/ui-uni/uParse/src/components/wxParseTemplate4.vue +88 -0
  65. package/ui-uni/uParse/src/components/wxParseTemplate5.vue +88 -0
  66. package/ui-uni/uParse/src/components/wxParseTemplate6.vue +88 -0
  67. package/ui-uni/uParse/src/components/wxParseTemplate7.vue +88 -0
  68. package/ui-uni/uParse/src/components/wxParseTemplate8.vue +88 -0
  69. package/ui-uni/uParse/src/components/wxParseTemplate9.vue +88 -0
  70. package/ui-uni/uParse/src/components/wxParseVideo.vue +15 -0
  71. package/ui-uni/uParse/src/editor.css +495 -0
  72. package/ui-uni/uParse/src/libs/html2json.js +261 -0
  73. package/ui-uni/uParse/src/libs/htmlparser.js +156 -0
  74. package/ui-uni/uParse/src/libs/wxDiscode.js +195 -0
  75. package/ui-uni/uParse/src/wxParse.css +270 -0
  76. package/ui-uni/uParse/src/wxParse.vue +206 -0
@@ -0,0 +1,261 @@
1
+ /**
2
+ * html2Json 改造来自: https://github.com/Jxck/html2json
3
+ *
4
+ *
5
+ * author: Di (微信小程序开发工程师)
6
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7
+ * 垂直微信小程序开发交流社区
8
+ *
9
+ * github地址: https://github.com/icindy/wxParse
10
+ *
11
+ * for: 微信小程序富文本解析
12
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13
+ */
14
+
15
+ import wxDiscode from './wxDiscode';
16
+ import HTMLParser from './htmlparser';
17
+
18
+ function makeMap(str) {
19
+ const obj = {};
20
+ const items = str.split(',');
21
+ for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
22
+ return obj;
23
+ }
24
+
25
+ // Block Elements - HTML 5
26
+ const block = makeMap('br,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
27
+
28
+ // Inline Elements - HTML 5
29
+ const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
30
+
31
+ // Elements that you can, intentionally, leave open
32
+ // (and which close themselves)
33
+ const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
34
+
35
+ function removeDOCTYPE(html) {
36
+ const isDocument = /<body.*>([^]*)<\/body>/.test(html);
37
+ return isDocument ? RegExp.$1 : html;
38
+ }
39
+
40
+ function trimHtml(html) {
41
+ return html
42
+ .replace(/<!--.*?-->/gi, '')
43
+ .replace(/\/\*.*?\*\//gi, '')
44
+ .replace(/[ ]+</gi, '<')
45
+ .replace(/<script[^]*<\/script>/gi, '')
46
+ .replace(/<style[^]*<\/style>/gi, '');
47
+ }
48
+
49
+ function getScreenInfo() {
50
+ const screen = {};
51
+ wx.getSystemInfo({
52
+ success: (res) => {
53
+ screen.width = res.windowWidth;
54
+ screen.height = res.windowHeight;
55
+ },
56
+ });
57
+ return screen;
58
+ }
59
+
60
+ function html2json(html, customHandler, imageProp, host) {
61
+ // 处理字符串
62
+ html = removeDOCTYPE(html);
63
+ html = trimHtml(html);
64
+ html = wxDiscode.strDiscode(html);
65
+ // 生成node节点
66
+ const bufArray = [];
67
+ const results = {
68
+ nodes: [],
69
+ imageUrls: [],
70
+ };
71
+
72
+ const screen = getScreenInfo();
73
+ function Node(tag) {
74
+ this.node = 'element';
75
+ this.tag = tag;
76
+
77
+ this.$screen = screen;
78
+ }
79
+
80
+ HTMLParser(html, {
81
+ start(tag, attrs, unary) {
82
+ // node for this element
83
+ const node = new Node(tag);
84
+
85
+ if (bufArray.length !== 0) {
86
+ const parent = bufArray[0];
87
+ if (parent.nodes === undefined) {
88
+ parent.nodes = [];
89
+ }
90
+ }
91
+
92
+ if (block[tag]) {
93
+ node.tagType = 'block';
94
+ } else if (inline[tag]) {
95
+ node.tagType = 'inline';
96
+ } else if (closeSelf[tag]) {
97
+ node.tagType = 'closeSelf';
98
+ }
99
+
100
+ node.attr = attrs.reduce((pre, attr) => {
101
+ const { name } = attr;
102
+ let { value } = attr;
103
+ if (name === 'class') {
104
+ node.classStr = value;
105
+ }
106
+ // has multi attibutes
107
+ // make it array of attribute
108
+ if (name === 'style') {
109
+ node.styleStr = value;
110
+ }
111
+ if (value.match(/ /)) {
112
+ value = value.split(' ');
113
+ }
114
+
115
+ // if attr already exists
116
+ // merge it
117
+ if (pre[name]) {
118
+ if (Array.isArray(pre[name])) {
119
+ // already array, push to last
120
+ pre[name].push(value);
121
+ } else {
122
+ // single value, make it array
123
+ pre[name] = [pre[name], value];
124
+ }
125
+ } else {
126
+ // not exist, put it
127
+ pre[name] = value;
128
+ }
129
+
130
+ return pre;
131
+ }, {});
132
+
133
+ // 优化样式相关属性
134
+ if (node.classStr) {
135
+ node.classStr += ` ${node.tag}`;
136
+ } else {
137
+ node.classStr = node.tag;
138
+ }
139
+ if (node.tagType === 'inline') {
140
+ node.classStr += ' inline';
141
+ }
142
+
143
+ // 对img添加额外数据
144
+ if (node.tag === 'img') {
145
+ let imgUrl = node.attr.src;
146
+ imgUrl = wxDiscode.urlToHttpUrl(imgUrl, imageProp.domain);
147
+ Object.assign(node.attr, imageProp, {
148
+ src: imgUrl || '',
149
+ });
150
+ if (imgUrl) {
151
+ results.imageUrls.push(imgUrl);
152
+ }
153
+ }
154
+
155
+ // 处理a标签属性
156
+ if (node.tag === 'a') {
157
+ node.attr.href = node.attr.href || '';
158
+ }
159
+
160
+ // 处理font标签样式属性
161
+ if (node.tag === 'font') {
162
+ const fontSize = [
163
+ 'x-small',
164
+ 'small',
165
+ 'medium',
166
+ 'large',
167
+ 'x-large',
168
+ 'xx-large',
169
+ '-webkit-xxx-large',
170
+ ];
171
+ const styleAttrs = {
172
+ color: 'color',
173
+ face: 'font-family',
174
+ size: 'font-size',
175
+ };
176
+ if (!node.styleStr) node.styleStr = '';
177
+ Object.keys(styleAttrs).forEach((key) => {
178
+ if (node.attr[key]) {
179
+ const value = key === 'size' ? fontSize[node.attr[key] - 1] : node.attr[key];
180
+ node.styleStr += `${styleAttrs[key]}: ${value};`;
181
+ }
182
+ });
183
+ }
184
+
185
+ // 临时记录source资源
186
+ if (node.tag === 'source') {
187
+ results.source = node.attr.src;
188
+ }
189
+
190
+ if (customHandler.start) {
191
+ customHandler.start(node, results);
192
+ }
193
+
194
+ if (unary) {
195
+ // if this tag doesn't have end tag
196
+ // like <img src="hoge.png"/>
197
+ // add to parents
198
+ const parent = bufArray[0] || results;
199
+ if (parent.nodes === undefined) {
200
+ parent.nodes = [];
201
+ }
202
+ parent.nodes.push(node);
203
+ } else {
204
+ bufArray.unshift(node);
205
+ }
206
+ },
207
+ end(tag) {
208
+ // merge into parent tag
209
+ const node = bufArray.shift();
210
+ if (node.tag !== tag) {
211
+ console.error('invalid state: mismatch end tag');
212
+ }
213
+
214
+ // 当有缓存source资源时于于video补上src资源
215
+ if (node.tag === 'video' && results.source) {
216
+ node.attr.src = results.source;
217
+ delete results.source;
218
+ }
219
+
220
+ if (customHandler.end) {
221
+ customHandler.end(node, results);
222
+ }
223
+
224
+ if (bufArray.length === 0) {
225
+ results.nodes.push(node);
226
+ } else {
227
+ const parent = bufArray[0];
228
+ if (!parent.nodes) {
229
+ parent.nodes = [];
230
+ }
231
+ parent.nodes.push(node);
232
+ }
233
+ },
234
+ chars(text) {
235
+ if (!text.trim()) return;
236
+
237
+ const node = {
238
+ node: 'text',
239
+ text,
240
+ };
241
+
242
+ if (customHandler.chars) {
243
+ customHandler.chars(node, results);
244
+ }
245
+
246
+ if (bufArray.length === 0) {
247
+ results.nodes.push(node);
248
+ } else {
249
+ const parent = bufArray[0];
250
+ if (parent.nodes === undefined) {
251
+ parent.nodes = [];
252
+ }
253
+ parent.nodes.push(node);
254
+ }
255
+ },
256
+ });
257
+
258
+ return results;
259
+ }
260
+
261
+ export default html2json;
@@ -0,0 +1,156 @@
1
+ /**
2
+ *
3
+ * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
4
+ *
5
+ * author: Di (微信小程序开发工程师)
6
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7
+ * 垂直微信小程序开发交流社区
8
+ *
9
+ * github地址: https://github.com/icindy/wxParse
10
+ *
11
+ * for: 微信小程序富文本解析
12
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13
+ */
14
+ // Regular Expressions for parsing tags and attributes
15
+
16
+ const startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
17
+ const endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
18
+ const attr = /([a-zA-Z0-9_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
19
+
20
+ function makeMap(str) {
21
+ const obj = {};
22
+ const items = str.split(',');
23
+ for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
24
+ return obj;
25
+ }
26
+
27
+ // Empty Elements - HTML 5
28
+ const empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr');
29
+
30
+ // Block Elements - HTML 5
31
+ const block = makeMap('address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
32
+
33
+ // Inline Elements - HTML 5
34
+ const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
35
+
36
+ // Elements that you can, intentionally, leave open
37
+ // (and which close themselves)
38
+ const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
39
+
40
+ // Attributes that have their values filled in disabled="disabled"
41
+ const fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected');
42
+
43
+ function HTMLParser(html, handler) {
44
+ let index;
45
+ let chars;
46
+ let match;
47
+ let last = html;
48
+ const stack = [];
49
+
50
+ stack.last = () => stack[stack.length - 1];
51
+
52
+ function parseEndTag(tag, tagName) {
53
+ // If no tag name is provided, clean shop
54
+ let pos;
55
+ if (!tagName) {
56
+ pos = 0;
57
+ } else {
58
+ // Find the closest opened tag of the same type
59
+ tagName = tagName.toLowerCase();
60
+ for (pos = stack.length - 1; pos >= 0; pos -= 1) {
61
+ if (stack[pos] === tagName) break;
62
+ }
63
+ }
64
+ if (pos >= 0) {
65
+ // Close all the open elements, up the stack
66
+ for (let i = stack.length - 1; i >= pos; i -= 1) {
67
+ if (handler.end) handler.end(stack[i]);
68
+ }
69
+
70
+ // Remove the open elements from the stack
71
+ stack.length = pos;
72
+ }
73
+ }
74
+
75
+ function parseStartTag(tag, tagName, rest, unary) {
76
+ tagName = tagName.toLowerCase();
77
+
78
+ if (block[tagName]) {
79
+ while (stack.last() && inline[stack.last()]) {
80
+ parseEndTag('', stack.last());
81
+ }
82
+ }
83
+
84
+ if (closeSelf[tagName] && stack.last() === tagName) {
85
+ parseEndTag('', tagName);
86
+ }
87
+
88
+ unary = empty[tagName] || !!unary;
89
+
90
+ if (!unary) stack.push(tagName);
91
+
92
+ if (handler.start) {
93
+ const attrs = [];
94
+
95
+ rest.replace(attr, function genAttr(matches, name) {
96
+ const value = arguments[2] || arguments[3] || arguments[4] || (fillAttrs[name] ? name : '');
97
+
98
+ attrs.push({
99
+ name,
100
+ value,
101
+ escaped: value.replace(/(^|[^\\])"/g, '$1\\"'), // "
102
+ });
103
+ });
104
+
105
+ if (handler.start) {
106
+ handler.start(tagName, attrs, unary);
107
+ }
108
+ }
109
+ }
110
+
111
+ while (html) {
112
+ chars = true;
113
+
114
+ if (html.indexOf('</') === 0) {
115
+ match = html.match(endTag);
116
+
117
+ if (match) {
118
+ html = html.substring(match[0].length);
119
+ match[0].replace(endTag, parseEndTag);
120
+ chars = false;
121
+ }
122
+
123
+ // start tag
124
+ } else if (html.indexOf('<') === 0) {
125
+ match = html.match(startTag);
126
+
127
+ if (match) {
128
+ html = html.substring(match[0].length);
129
+ match[0].replace(startTag, parseStartTag);
130
+ chars = false;
131
+ }
132
+ }
133
+
134
+ if (chars) {
135
+ index = html.indexOf('<');
136
+ let text = '';
137
+ while (index === 0) {
138
+ text += '<';
139
+ html = html.substring(1);
140
+ index = html.indexOf('<');
141
+ }
142
+ text += index < 0 ? html : html.substring(0, index);
143
+ html = index < 0 ? '' : html.substring(index);
144
+
145
+ if (handler.chars) handler.chars(text);
146
+ }
147
+
148
+ if (html === last) throw new Error(`Parse Error: ${html}`);
149
+ last = html;
150
+ }
151
+
152
+ // Clean up any remaining tags
153
+ parseEndTag();
154
+ }
155
+
156
+ export default HTMLParser;
@@ -0,0 +1,195 @@
1
+ // HTML 支持的数学符号
2
+ function strNumDiscode(str) {
3
+ str = str.replace(/&forall;/g, '∀');
4
+ str = str.replace(/&part;/g, '∂');
5
+ str = str.replace(/&exist;/g, '∃');
6
+ str = str.replace(/&empty;/g, '∅');
7
+ str = str.replace(/&nabla;/g, '∇');
8
+ str = str.replace(/&isin;/g, '∈');
9
+ str = str.replace(/&notin;/g, '∉');
10
+ str = str.replace(/&ni;/g, '∋');
11
+ str = str.replace(/&prod;/g, '∏');
12
+ str = str.replace(/&sum;/g, '∑');
13
+ str = str.replace(/&minus;/g, '−');
14
+ str = str.replace(/&lowast;/g, '∗');
15
+ str = str.replace(/&radic;/g, '√');
16
+ str = str.replace(/&prop;/g, '∝');
17
+ str = str.replace(/&infin;/g, '∞');
18
+ str = str.replace(/&ang;/g, '∠');
19
+ str = str.replace(/&and;/g, '∧');
20
+ str = str.replace(/&or;/g, '∨');
21
+ str = str.replace(/&cap;/g, '∩');
22
+ str = str.replace(/&cup;/g, '∪');
23
+ str = str.replace(/&int;/g, '∫');
24
+ str = str.replace(/&there4;/g, '∴');
25
+ str = str.replace(/&sim;/g, '∼');
26
+ str = str.replace(/&cong;/g, '≅');
27
+ str = str.replace(/&asymp;/g, '≈');
28
+ str = str.replace(/&ne;/g, '≠');
29
+ str = str.replace(/&le;/g, '≤');
30
+ str = str.replace(/&ge;/g, '≥');
31
+ str = str.replace(/&sub;/g, '⊂');
32
+ str = str.replace(/&sup;/g, '⊃');
33
+ str = str.replace(/&nsub;/g, '⊄');
34
+ str = str.replace(/&sube;/g, '⊆');
35
+ str = str.replace(/&supe;/g, '⊇');
36
+ str = str.replace(/&oplus;/g, '⊕');
37
+ str = str.replace(/&otimes;/g, '⊗');
38
+ str = str.replace(/&perp;/g, '⊥');
39
+ str = str.replace(/&sdot;/g, '⋅');
40
+ return str;
41
+ }
42
+
43
+ // HTML 支持的希腊字母
44
+ function strGreeceDiscode(str) {
45
+ str = str.replace(/&Alpha;/g, 'Α');
46
+ str = str.replace(/&Beta;/g, 'Β');
47
+ str = str.replace(/&Gamma;/g, 'Γ');
48
+ str = str.replace(/&Delta;/g, 'Δ');
49
+ str = str.replace(/&Epsilon;/g, 'Ε');
50
+ str = str.replace(/&Zeta;/g, 'Ζ');
51
+ str = str.replace(/&Eta;/g, 'Η');
52
+ str = str.replace(/&Theta;/g, 'Θ');
53
+ str = str.replace(/&Iota;/g, 'Ι');
54
+ str = str.replace(/&Kappa;/g, 'Κ');
55
+ str = str.replace(/&Lambda;/g, 'Λ');
56
+ str = str.replace(/&Mu;/g, 'Μ');
57
+ str = str.replace(/&Nu;/g, 'Ν');
58
+ str = str.replace(/&Xi;/g, 'Ν');
59
+ str = str.replace(/&Omicron;/g, 'Ο');
60
+ str = str.replace(/&Pi;/g, 'Π');
61
+ str = str.replace(/&Rho;/g, 'Ρ');
62
+ str = str.replace(/&Sigma;/g, 'Σ');
63
+ str = str.replace(/&Tau;/g, 'Τ');
64
+ str = str.replace(/&Upsilon;/g, 'Υ');
65
+ str = str.replace(/&Phi;/g, 'Φ');
66
+ str = str.replace(/&Chi;/g, 'Χ');
67
+ str = str.replace(/&Psi;/g, 'Ψ');
68
+ str = str.replace(/&Omega;/g, 'Ω');
69
+
70
+ str = str.replace(/&alpha;/g, 'α');
71
+ str = str.replace(/&beta;/g, 'β');
72
+ str = str.replace(/&gamma;/g, 'γ');
73
+ str = str.replace(/&delta;/g, 'δ');
74
+ str = str.replace(/&epsilon;/g, 'ε');
75
+ str = str.replace(/&zeta;/g, 'ζ');
76
+ str = str.replace(/&eta;/g, 'η');
77
+ str = str.replace(/&theta;/g, 'θ');
78
+ str = str.replace(/&iota;/g, 'ι');
79
+ str = str.replace(/&kappa;/g, 'κ');
80
+ str = str.replace(/&lambda;/g, 'λ');
81
+ str = str.replace(/&mu;/g, 'μ');
82
+ str = str.replace(/&nu;/g, 'ν');
83
+ str = str.replace(/&xi;/g, 'ξ');
84
+ str = str.replace(/&omicron;/g, 'ο');
85
+ str = str.replace(/&pi;/g, 'π');
86
+ str = str.replace(/&rho;/g, 'ρ');
87
+ str = str.replace(/&sigmaf;/g, 'ς');
88
+ str = str.replace(/&sigma;/g, 'σ');
89
+ str = str.replace(/&tau;/g, 'τ');
90
+ str = str.replace(/&upsilon;/g, 'υ');
91
+ str = str.replace(/&phi;/g, 'φ');
92
+ str = str.replace(/&chi;/g, 'χ');
93
+ str = str.replace(/&psi;/g, 'ψ');
94
+ str = str.replace(/&omega;/g, 'ω');
95
+ str = str.replace(/&thetasym;/g, 'ϑ');
96
+ str = str.replace(/&upsih;/g, 'ϒ');
97
+ str = str.replace(/&piv;/g, 'ϖ');
98
+ str = str.replace(/&middot;/g, '·');
99
+ return str;
100
+ }
101
+
102
+ function strcharacterDiscode(str) {
103
+ // 加入常用解析
104
+ str = str.replace(/&nbsp;/g, ' ');
105
+ str = str.replace(/&ensp;/g, ' ');
106
+ str = str.replace(/&emsp;/g, ' ');
107
+ str = str.replace(/&quot;/g, "'");
108
+ str = str.replace(/&amp;/g, '&');
109
+ str = str.replace(/&lt;/g, '<');
110
+ str = str.replace(/&gt;/g, '>');
111
+ str = str.replace(/&#8226;/g, '•');
112
+
113
+ return str;
114
+ }
115
+
116
+ // HTML 支持的其他实体
117
+ function strOtherDiscode(str) {
118
+ str = str.replace(/&OElig;/g, 'Œ');
119
+ str = str.replace(/&oelig;/g, 'œ');
120
+ str = str.replace(/&Scaron;/g, 'Š');
121
+ str = str.replace(/&scaron;/g, 'š');
122
+ str = str.replace(/&Yuml;/g, 'Ÿ');
123
+ str = str.replace(/&fnof;/g, 'ƒ');
124
+ str = str.replace(/&circ;/g, 'ˆ');
125
+ str = str.replace(/&tilde;/g, '˜');
126
+ str = str.replace(/&ensp;/g, '');
127
+ str = str.replace(/&emsp;/g, '');
128
+ str = str.replace(/&thinsp;/g, '');
129
+ str = str.replace(/&zwnj;/g, '');
130
+ str = str.replace(/&zwj;/g, '');
131
+ str = str.replace(/&lrm;/g, '');
132
+ str = str.replace(/&rlm;/g, '');
133
+ str = str.replace(/&ndash;/g, '–');
134
+ str = str.replace(/&mdash;/g, '—');
135
+ str = str.replace(/&lsquo;/g, '‘');
136
+ str = str.replace(/&rsquo;/g, '’');
137
+ str = str.replace(/&sbquo;/g, '‚');
138
+ str = str.replace(/&ldquo;/g, '“');
139
+ str = str.replace(/&rdquo;/g, '”');
140
+ str = str.replace(/&bdquo;/g, '„');
141
+ str = str.replace(/&dagger;/g, '†');
142
+ str = str.replace(/&Dagger;/g, '‡');
143
+ str = str.replace(/&bull;/g, '•');
144
+ str = str.replace(/&hellip;/g, '…');
145
+ str = str.replace(/&permil;/g, '‰');
146
+ str = str.replace(/&prime;/g, '′');
147
+ str = str.replace(/&Prime;/g, '″');
148
+ str = str.replace(/&lsaquo;/g, '‹');
149
+ str = str.replace(/&rsaquo;/g, '›');
150
+ str = str.replace(/&oline;/g, '‾');
151
+ str = str.replace(/&euro;/g, '€');
152
+ str = str.replace(/&trade;/g, '™');
153
+
154
+ str = str.replace(/&larr;/g, '←');
155
+ str = str.replace(/&uarr;/g, '↑');
156
+ str = str.replace(/&rarr;/g, '→');
157
+ str = str.replace(/&darr;/g, '↓');
158
+ str = str.replace(/&harr;/g, '↔');
159
+ str = str.replace(/&crarr;/g, '↵');
160
+ str = str.replace(/&lceil;/g, '⌈');
161
+ str = str.replace(/&rceil;/g, '⌉');
162
+
163
+ str = str.replace(/&lfloor;/g, '⌊');
164
+ str = str.replace(/&rfloor;/g, '⌋');
165
+ str = str.replace(/&loz;/g, '◊');
166
+ str = str.replace(/&spades;/g, '♠');
167
+ str = str.replace(/&clubs;/g, '♣');
168
+ str = str.replace(/&hearts;/g, '♥');
169
+
170
+ str = str.replace(/&diams;/g, '♦');
171
+ str = str.replace(/&#39;/g, "'");
172
+ return str;
173
+ }
174
+
175
+ function strDiscode(str) {
176
+ str = strNumDiscode(str);
177
+ str = strGreeceDiscode(str);
178
+ str = strcharacterDiscode(str);
179
+ str = strOtherDiscode(str);
180
+ return str;
181
+ }
182
+
183
+ function urlToHttpUrl(url, domain) {
184
+ if (/^\/\//.test(url)) {
185
+ return `https:${url}`;
186
+ } else if (/^\//.test(url)) {
187
+ return `https://${domain}${url}`;
188
+ }
189
+ return url;
190
+ }
191
+
192
+ export default {
193
+ strDiscode,
194
+ urlToHttpUrl,
195
+ };