yymini-pop-html 1.0.0

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.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # yymini-pop-html
2
+ 小程序(抖音) 轻量级底部显示富文本弹出框 自定义组件,无需额外依赖,开箱即用。
3
+
4
+ ## 🌟 特性
5
+ - 原生小程序语法,兼容小程序(抖音)基础库
6
+ - 支持自定义 标题、富文本内容、按钮等
7
+ - 提供 确认/取消 回调,支持 遮罩关闭
8
+ - 支持富文本内容内部点击linktap
9
+ - 样式简洁美观,可自定义修改
10
+
11
+ ## 📦 安装
12
+ 在你的小程序项目根目录执行:
13
+
14
+ ```bash
15
+ npm install yymini-pop-html --save
16
+ or
17
+ yarn add yymini-pop-html
18
+
19
+ 然后在 开发者工具中 构建 NPM
20
+ ```
21
+
22
+ ## 🎨 引用
23
+ ```json
24
+ {
25
+ "usingComponents": {
26
+ "pop-html": "/miniprogram_npm/yymini-pop-html/pop-html"
27
+ }
28
+ }
29
+ ```
30
+
31
+ ## ▶️ use
32
+ ```ttml / wxml
33
+ <pop-html visible="{{true}}" title="这里是 title" content="这里是富文本 content" bind:close="onClose" bind:linktap="onLinktap" />
34
+ ```
35
+
36
+ ## 👀 示例效果
37
+ ![弹窗示例](https://raw.githubusercontent.com/AllenGe/yy/main/pop-image-html.png)
package/back.png ADDED
Binary file
package/bgSrc.png ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "yymini-pop-html",
3
+ "version": "1.0.0",
4
+ "description": "小程序(抖音)-底部富文本弹出框自定义组件",
5
+ "main": "pop-html.js",
6
+ "miniprogram": ".",
7
+ "keywords": [
8
+ "douyin",
9
+ "miniProgram",
10
+ "抖音小程序",
11
+ "confirm",
12
+ "modal",
13
+ "弹出框",
14
+ "底部弹出框"
15
+ ],
16
+ "author": "Allen.ge <gyjshow@163.com>",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "",
20
+ "url": ""
21
+ },
22
+ "bugs": {
23
+ "url": ""
24
+ },
25
+ "homepage": "",
26
+ "private": false,
27
+ "files": [
28
+ "*.png",
29
+ "yy-html",
30
+ "pop-html.*",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "test": "echo \"Error: no test specified\" && exit 1"
35
+ }
36
+ }
package/pop-html.js ADDED
@@ -0,0 +1,74 @@
1
+ Component({
2
+ properties: {
3
+ visible: { // 接收页面传递的显示状态
4
+ type: Boolean,
5
+ value: false,
6
+ observer(newVal) {
7
+ this.setData({
8
+ show: newVal
9
+ });
10
+ }
11
+ },
12
+
13
+ zindex: {
14
+ type: Number,
15
+ value: 999
16
+ },
17
+ content: {
18
+ type: String,
19
+ value: ''
20
+ },
21
+ height: {
22
+ type: Number,
23
+ value: 85
24
+ }, // 弹窗高度 80%
25
+ title: {
26
+ type: String,
27
+ value: ''
28
+ }, // 弹窗标题
29
+ bgSrc: {
30
+ type: String,
31
+ value: "bgSrc.png"
32
+ }, // 背景图片地址
33
+ maskCloseable: {
34
+ type: Boolean,
35
+ value: false
36
+ } // 遮罩点击是否关闭
37
+
38
+ },
39
+
40
+ data: {
41
+ show: false // 内部维护显示状态,避免异步延迟
42
+ },
43
+
44
+ methods: {
45
+ // 遮罩点击:关闭弹窗+触发取消事件
46
+ onMaskClick() {
47
+ if (this.data.maskCloseable) {
48
+ this.setData({
49
+ show: false
50
+ })
51
+ this.triggerEvent('close');
52
+ }
53
+ },
54
+
55
+ // 阻止内容区点击穿透到遮罩
56
+ stopPropagation() {},
57
+
58
+ onClose(e) {
59
+ console.log('onClose onClose.... ', e);
60
+ this.setData({
61
+ show: false
62
+ })
63
+ this.triggerEvent('close');
64
+ },
65
+
66
+ linktap(event) {
67
+ this.triggerEvent('linktap', {
68
+ ...event?.detail
69
+ });
70
+ },
71
+
72
+ }
73
+
74
+ });
package/pop-html.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "yy-html": "./yy-html/yy-html"
5
+ }
6
+ }
package/pop-html.ttml ADDED
@@ -0,0 +1,27 @@
1
+ <!-- 遮罩层:全屏,控制显示/隐藏 -->
2
+ <view class="view-mask {{show ? 'show' : ''}}" style="z-index: {{zindex}};" bindtap="onMaskClick">
3
+ <!-- 弹窗主体:固定在底部,宽度100% -->
4
+ <view class="view-content" style="height: {{height}}%;" catchtap="stopPropagation">
5
+ <!-- 背景图 -->
6
+ <image src="bgSrc.png" class="img-bg"></image>
7
+
8
+ <view class="view-area">
9
+ <!-- 返回按钮左上角 -->
10
+ <view class="popup-close" bindtap="onClose">
11
+ <image src="back.png" class="comment_zuo"></image>
12
+ </view>
13
+
14
+ <!-- 标题 -->
15
+ <view tt:if="{{title}}" class="popup-title" bindtap="onClose">
16
+ {{title}}
17
+ </view>
18
+
19
+ <view class="view-html">
20
+ <view class="view-c">
21
+ <yy-html bind:linktap="linktap" content="{{content}}"></yy-html>
22
+ </view>
23
+ </view>
24
+ </view>
25
+
26
+ </view>
27
+ </view>
package/pop-html.ttss ADDED
@@ -0,0 +1,183 @@
1
+ /* 遮罩层:全屏、透明、不可点击(初始状态) */
2
+ .view-mask {
3
+ position: fixed;
4
+ top: 0;
5
+ left: 0;
6
+ right: 0;
7
+ bottom: 0;
8
+ background: rgba(0, 0, 0, 0.45);
9
+
10
+ opacity: 0;
11
+ pointer-events: none;
12
+ transition: opacity 0.3s ease;
13
+
14
+ /* z-index: 999; */
15
+ }
16
+
17
+ /* 遮罩显示:不透明+可点击 */
18
+ .view-mask.show {
19
+ opacity: 1;
20
+ pointer-events: auto;
21
+ }
22
+
23
+ /* 弹窗主体:固定底部,初始滑出屏幕 */
24
+ .view-content {
25
+ position: absolute;
26
+ bottom: 0;
27
+ left: 0;
28
+ right: 0;
29
+
30
+ display: flex;
31
+ flex-direction: column;
32
+
33
+ background: #ffffff;
34
+ border-top-left-radius: 40rpx;
35
+ border-top-right-radius: 40rpx;
36
+
37
+ box-sizing: border-box;
38
+ /* 初始状态:滑出屏幕底部 */
39
+ transform: translateY(100%);
40
+ transition: transform 0.3s ease-out;
41
+
42
+ /* height: 20%;
43
+ min-height: 45%; */
44
+ }
45
+
46
+ .view-area {
47
+ position: absolute;
48
+ top: 0;
49
+ bottom: 0;
50
+ left: 0;
51
+ right: 0;
52
+
53
+ display: flex;
54
+ flex-direction: column;
55
+ }
56
+
57
+ .img-bg {
58
+ position: absolute;
59
+ top: 0;
60
+ right: 0;
61
+ bottom: 0;
62
+ left: 0;
63
+ width: 100%;
64
+ height: 100%;
65
+ }
66
+
67
+ /* 弹窗显示:滑入屏幕 */
68
+ .view-mask.show .view-content {
69
+ transform: translateY(0);
70
+ }
71
+
72
+ /* 通用样式:适配抖音规范 */
73
+ .popup-title {
74
+ display: flex;
75
+ justify-content: center;
76
+ align-items: center;
77
+ height: 120rpx;
78
+ font-size: 40rpx;
79
+ font-weight: 500;
80
+ color: #232832;
81
+ /* background-color: #f7f7f7; */
82
+ }
83
+
84
+ .view-html {
85
+ display: flex;
86
+ flex: 1;
87
+ background-color: #FFFFFF;
88
+ border-top-left-radius: 20rpx;
89
+ border-top-right-radius: 20rpx;
90
+ padding: 0 24rpx 30rpx;
91
+ margin: 0 20rpx;
92
+ overflow: hidden;
93
+ }
94
+
95
+ .view-c {
96
+ overflow-y: scroll;
97
+ }
98
+
99
+ .popup-close {
100
+ position: absolute;
101
+ top: 0;
102
+ left: 0;
103
+
104
+ width: 100rpx;
105
+ height: 120rpx;
106
+
107
+ display: flex;
108
+ align-items: center;
109
+ padding-left: 24rpx;
110
+ border-top-left-radius: 20rpx;
111
+ /* background-color: #f7f7f7; */
112
+ }
113
+
114
+ .comment_zuo {
115
+ width: 48rpx;
116
+ height: 48rpx;
117
+
118
+ transition: all 0.12s ease;
119
+ transform-origin: center center;
120
+
121
+ }
122
+
123
+
124
+ .popup-close:active .comment_zuo {
125
+ opacity: 0.65;
126
+ transform: scale(0.88);
127
+ filter: brightness(0.8);
128
+ filter: brightness(0.8) drop-shadow(0 1rpx 2rpx rgba(0, 0, 0, 0.1));
129
+ }
130
+
131
+ .popup-footer {
132
+ display: flex;
133
+ margin: 30rpx 30rpx 40rpx;
134
+ gap: 20rpx;
135
+ }
136
+
137
+
138
+ /* 核心重置:只解决伪元素遮挡+原生外观问题(必写) */
139
+ button {
140
+ -webkit-appearance: none !important;
141
+ /* 去掉原生外观(关键) */
142
+ appearance: none !important;
143
+ border: none !important;
144
+ /* 清空默认边框 */
145
+ }
146
+
147
+ button::after {
148
+ content: none !important;
149
+ /* 直接移除遮挡的伪元素(核心) */
150
+ }
151
+
152
+ .btn {
153
+ flex: 1;
154
+ height: 80rpx;
155
+ line-height: 80rpx;
156
+ border-radius: 40rpx;
157
+ border: none;
158
+ font-size: 28rpx;
159
+ padding: 0;
160
+ }
161
+
162
+ .cancel {
163
+ background: #FFFFFF;
164
+ color: #333333;
165
+ border: 2rpx solid #D1D1D6 !important;
166
+ /* transition: background-color 0.1s; */
167
+
168
+ /* box-shadow: 0 0 0 rgba(0, 0, 0, 0);
169
+ transition: box-shadow 0.1s; */
170
+ /* 按压 */
171
+ }
172
+
173
+ .cancel:active {
174
+ background-color: #f5f5f5;
175
+
176
+ /* box-shadow: inset 0 2rpx 4rpx rgba(0, 0, 0, 0.2); */
177
+ /* 按压 */
178
+ }
179
+
180
+ .confirm {
181
+ background: linear-gradient(180deg, #FF8684 0%, #CB6DF3 100%);
182
+ color: #ffffff;
183
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ function t(t, e) {
4
+ var r = Object.keys(t);
5
+ if (Object.getOwnPropertySymbols) {
6
+ var i = Object.getOwnPropertySymbols(t);
7
+ e && (i = i.filter(function(e) { return Object.getOwnPropertyDescriptor(t, e).enumerable })), r.push.apply(r, i)
8
+ }
9
+ return r
10
+ }
11
+
12
+ function e(e) {
13
+ for (var i = 1; i < arguments.length; i++) {
14
+ var o = null != arguments[i] ? arguments[i] : {};
15
+ i % 2 ? t(Object(o), !0).forEach(function(t) { r(e, t, o[t]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : t(Object(o)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t)) })
16
+ }
17
+ return e
18
+ }
19
+
20
+ function r(t, e, r) { return e in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t } Component({
21
+ data: { ctrl: {} },
22
+ properties: { childs: Array, opts: Array },
23
+ options: { addGlobalClass: !0 },
24
+ methods: {
25
+ noop: function() {},
26
+ getNode: function(t) { try { for (var e = t.split("_"), r = this.data.childs[e[0]], i = 1; i < e.length; i++) r = r.children[e[i]]; return r } catch (t) { return { text: "", attrs: {}, children: [] } } },
27
+ play: function(t) {
28
+ var r = t.target.dataset.i,
29
+ i = this.getNode(r);
30
+ if (this.root.triggerEvent("play", { source: i.name, attrs: e(e({}, i.attrs), {}, { src: i.src[this.data.ctrl[r] || 0] }) }), this.root.data.pauseVideo) {
31
+ for (var o = !1, a = t.target.id, s = this.root._videos.length; s--;) this.root._videos[s].id === a ? o = !0 : this.root._videos[s].pause();
32
+ if (!o) {
33
+ var n = tt.createVideoContext(a, this);
34
+ n.id = a, this.root.playbackRate && n.playbackRate(this.root.playbackRate), this.root._videos.push(n)
35
+ }
36
+ }
37
+ },
38
+ imgTap: function(t) {
39
+ var e = this.getNode(t.target.dataset.i);
40
+ if (e.a) return this.linkTap(e.a);
41
+ if (!e.attrs.ignore && (this.root.triggerEvent("imgtap", e.attrs), this.root.data.previewImg)) {
42
+ var r = this.root.imgList[e.i];
43
+ tt.previewImage({ current: r, urls: this.root.imgList })
44
+ }
45
+ },
46
+ imgLoad: function(t) {
47
+ var e, i = t.target.dataset.i,
48
+ o = this.getNode(i);
49
+ o.w ? (this.data.opts[1] && !this.data.ctrl[i] || -1 === this.data.ctrl[i]) && (e = 1) : e = t.detail.width, e && e !== this.data.ctrl[i] && this.setData(r({}, "ctrl." + i, e)), this.checkReady()
50
+ },
51
+ checkReady: function() {
52
+ var t = this;
53
+ this.root.data.lazyLoad || (this.root.imgList._unloadimgs -= 1, this.root.imgList._unloadimgs || setTimeout(() => { t.root.getRect().then(function(e) { t.root.triggerEvent("ready", e) }).catch(function() { t.root.triggerEvent("ready", {}) }) }, 350))
54
+ },
55
+ linkTap: function(t) {
56
+ var e = t.currentTarget ? this.getNode(t.currentTarget.dataset.i) : {},
57
+ r = e.attrs || t,
58
+ i = r.href;
59
+ this.root.triggerEvent("linktap", Object.assign({ innerText: this.root.getText(e.children || []) }, r)), i && ("#" === i[0] ? this.root.navigateTo(i.substring(1)).catch(function() {}) : i.split("?")[0].includes("://") ? this.root.data.copyLink && tt.setClipboardData({ data: i, success: function() { return tt.showToast({ title: "链接已复制" }) } }) : tt.navigateTo({ url: i, fail: function() { tt.switchTab({ url: i, fail: function() {} }) } }))
60
+ },
61
+ mediaError: function(t) {
62
+ var e = t.target.dataset.i,
63
+ i = this.getNode(e);
64
+ if ("video" === i.name || "audio" === i.name) { var o = (this.data.ctrl[e] || 0) + 1; if (o > i.src.length && (o = 0), o < i.src.length) return this.setData(r({}, "ctrl." + e, o)) } else "img" === i.name && (this.data.opts[2] && this.setData(r({}, "ctrl." + e, -1)), this.checkReady());
65
+ this.root && this.root.triggerEvent("error", { source: i.name, attrs: i.attrs, errMsg: t.detail.errMsg })
66
+ }
67
+ }
68
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "component": false,
3
+ "usingComponents": {
4
+ "node": "./node"
5
+ }
6
+ }
@@ -0,0 +1,32 @@
1
+ <template name="el">
2
+ <block tt:if="{{n.name==='img'}}"><rich-text tt:if="{{n.t}}" style="display:{{n.t}}"
3
+ nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchtap="imgTap" />
4
+ <block tt:else>
5
+ <image tt:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}"
6
+ src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix" />
7
+ <image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}"
8
+ style="width:{{ctrl[i]||1}}px;height:1px;{{ctrl[i]===-1?'display:none;':''}}{{n.attrs.style}}"
9
+ src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}"
10
+ data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop" />
11
+ </block>
12
+ </block>
13
+ <text tt:elif="{{n.text}}" decode>{{n.text}}</text>
14
+ <text tt:elif="{{n.name==='br'}}">{{'\n'}}</text>
15
+ <view tt:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}"
16
+ hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap">
17
+ <template is="node" data="{{childs:n.children,path:i+'_',opts:opts,ctrl:ctrl}}"></template>
18
+ </view>
19
+ <video tt:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}"
20
+ autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}"
21
+ object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}"
22
+ bindplay="play" binderror="mediaError" /><rich-text tt:else id="{{n.attrs.id}}" style="{{n.f}}" nodes="{{[n]}}" />
23
+ </template>
24
+ <template name="node">
25
+ <block tt:for="{{childs}}" tt:for-item="n" tt:for-index="i" tt:key="i">
26
+ <template tt:if="{{!n.c}}" is="el" data="{{n:n,i:path+i,opts:opts,ctrl:ctrl}}" />
27
+ <view tt:else id="{{n.attrs.id}}" class="_{{n.name}} {{n.attrs.class}}" style="{{n.attrs.style}}">
28
+ <template is="node" data="{{childs:n.children,path:path+i+'_',opts:opts,ctrl:ctrl}}"></template>
29
+ </view>
30
+ </block>
31
+ </template>
32
+ <template is="node" data="{{childs:childs,path:'',opts:opts,ctrl:ctrl}}"></template>
@@ -0,0 +1,150 @@
1
+ ._a {
2
+ padding: 1.5px 0 1.5px 0;
3
+ color: #366092;
4
+ word-break: break-all
5
+ }
6
+
7
+ ._hover {
8
+ text-decoration: underline;
9
+ opacity: .7
10
+ }
11
+
12
+ ._img {
13
+ max-width: 100%;
14
+ -webkit-touch-callout: none
15
+ }
16
+
17
+ ._b,
18
+ ._strong {
19
+ font-weight: 700
20
+ }
21
+
22
+ ._code {
23
+ font-family: monospace
24
+ }
25
+
26
+ ._del {
27
+ text-decoration: line-through
28
+ }
29
+
30
+ ._em,
31
+ ._i {
32
+ font-style: italic
33
+ }
34
+
35
+ ._h1 {
36
+ font-size: 2em
37
+ }
38
+
39
+ ._h2 {
40
+ font-size: 1.5em
41
+ }
42
+
43
+ ._h3 {
44
+ font-size: 1.17em
45
+ }
46
+
47
+ ._h5 {
48
+ font-size: .83em
49
+ }
50
+
51
+ ._h6 {
52
+ font-size: .67em
53
+ }
54
+
55
+ ._h1,
56
+ ._h2,
57
+ ._h3,
58
+ ._h4,
59
+ ._h5,
60
+ ._h6 {
61
+ display: block;
62
+ font-weight: 700
63
+ }
64
+
65
+ ._ins {
66
+ text-decoration: underline
67
+ }
68
+
69
+ ._li {
70
+ display: list-item
71
+ }
72
+
73
+ ._ol {
74
+ list-style-type: decimal
75
+ }
76
+
77
+ ._ol,
78
+ ._ul {
79
+ display: block;
80
+ padding-left: 40px;
81
+ margin: 1em 0
82
+ }
83
+
84
+ ._q::before {
85
+ content: '"'
86
+ }
87
+
88
+ ._q::after {
89
+ content: '"'
90
+ }
91
+
92
+ ._sub {
93
+ font-size: smaller;
94
+ vertical-align: sub
95
+ }
96
+
97
+ ._sup {
98
+ font-size: smaller;
99
+ vertical-align: super
100
+ }
101
+
102
+ ._tbody,
103
+ ._tfoot,
104
+ ._thead {
105
+ display: table-row-group
106
+ }
107
+
108
+ ._tr {
109
+ display: table-row
110
+ }
111
+
112
+ ._td,
113
+ ._th {
114
+ display: table-cell;
115
+ vertical-align: middle
116
+ }
117
+
118
+ ._th {
119
+ font-weight: 700;
120
+ text-align: center
121
+ }
122
+
123
+ ._ul {
124
+ list-style-type: disc
125
+ }
126
+
127
+ ._ul ._ul {
128
+ margin: 0;
129
+ list-style-type: circle
130
+ }
131
+
132
+ ._ul ._ul ._ul {
133
+ list-style-type: square
134
+ }
135
+
136
+ ._abbr,
137
+ ._b,
138
+ ._code,
139
+ ._del,
140
+ ._em,
141
+ ._i,
142
+ ._ins,
143
+ ._label,
144
+ ._q,
145
+ ._span,
146
+ ._strong,
147
+ ._sub,
148
+ ._sup {
149
+ display: inline
150
+ }
@@ -0,0 +1,325 @@
1
+ "use strict";
2
+
3
+ function t(t, e) {
4
+ var s;
5
+ if ("undefined" == typeof Symbol || null == t[Symbol.iterator]) {
6
+ if (Array.isArray(t) || (s = i(t)) || e && t && "number" == typeof t.length) {
7
+ s && (t = s);
8
+ var n = 0,
9
+ a = function() {};
10
+ return { s: a, n: function() { return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] } }, e: function(t) { throw t }, f: a }
11
+ }
12
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
13
+ }
14
+ var r, o = !0,
15
+ l = !1;
16
+ return { s: function() { s = t[Symbol.iterator]() }, n: function() { var t = s.next(); return o = t.done, t }, e: function(t) { l = !0, r = t }, f: function() { try { o || null == s.return || s.return() } finally { if (l) throw r } } }
17
+ }
18
+
19
+ function i(t, i) { if (t) { if ("string" == typeof t) return e(t, i); var s = Object.prototype.toString.call(t).slice(8, -1); return "Object" === s && t.constructor && (s = t.constructor.name), "Map" === s || "Set" === s ? Array.from(t) : "Arguments" === s || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? e(t, i) : void 0 } }
20
+
21
+ function e(t, i) {
22
+ (null == i || i > t.length) && (i = t.length);
23
+ for (var e = 0, s = new Array(i); e < i; e++) s[e] = t[e];
24
+ return s
25
+ }
26
+
27
+ function s(t) { for (var i = Object.create(null), e = t.split(","), s = e.length; s--;) i[e[s]] = !0; return i }
28
+
29
+ function n(t, i) {
30
+ for (var e = t.indexOf("&"); - 1 !== e;) {
31
+ var s = t.indexOf(";", e + 3),
32
+ n = void 0;
33
+ if (-1 === s) break;
34
+ "#" === t[e + 1] ? (n = parseInt(("x" === t[e + 2] ? "0" : "") + t.substring(e + 2, s)), isNaN(n) || (t = t.substr(0, e) + String.fromCharCode(n) + t.substr(s + 1))) : (n = t.substring(e + 1, s), (l.entities[n] || "amp" === n && i) && (t = t.substr(0, e) + (l.entities[n] || "&") + t.substr(s + 1))), e = t.indexOf("&", e + 1)
35
+ }
36
+ return t
37
+ }
38
+
39
+ function a(t) { for (var i = t.length - 1, e = i; e >= -1; e--)(-1 === e || t[e].c || !t[e].name || "div" !== t[e].name && "p" !== t[e].name && "h" !== t[e].name[0] || (t[e].attrs.style || "").includes("inline")) && (i - e >= 5 && t.splice(e + 1, i - e, { name: "div", attrs: {}, children: t.slice(e + 1, i + 1) }), i = e - 1) }
40
+
41
+ function r(t) { this.options = t.data || {}, this.tagStyle = Object.assign({}, l.tagStyle, this.options.tagStyle), this.imgList = t.imgList || [], this.imgList._unloadimgs = 0, this.plugins = t.plugins || [], this.attrs = Object.create(null), this.stack = [], this.nodes = [], this.pre = (this.options.containerStyle || "").includes("white-space") && this.options.containerStyle.includes("pre") ? 2 : 0 }
42
+
43
+ function o(t) { this.handler = t }
44
+ var l = { trustTags: s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"), blockTags: s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"), ignoreTags: s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"), voidTags: s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"), entities: { lt: "<", gt: ">", quot: '"', apos: "'", ensp: " ", emsp: " ", nbsp: " ", semi: ";", ndash: "–", mdash: "—", middot: "·", lsquo: "‘", rsquo: "’", ldquo: "“", rdquo: "”", bull: "•", hellip: "…", larr: "←", uarr: "↑", rarr: "→", darr: "↓" }, tagStyle: { address: "font-style:italic", big: "display:inline;font-size:1.2em", caption: "display:table-caption;text-align:center", center: "text-align:center", cite: "font-style:italic", dd: "margin-left:40px", mark: "background-color:yellow", pre: "font-family:monospace;white-space:pre", s: "text-decoration:line-through", small: "display:inline;font-size:0.8em", strike: "text-decoration:line-through", u: "text-decoration:underline" }, svgDict: { animatetransform: "animateTransform", lineargradient: "linearGradient", viewbox: "viewBox", attributename: "attributeName", repeatcount: "repeatCount", repeatdur: "repeatDur", foreignobject: "foreignObject" } },
45
+ h = {},
46
+ c, d, p = tt.getSystemInfoSync();
47
+ c = p.windowWidth;
48
+ var u = s(" ,\r,\n,\t,\f"),
49
+ f = 0;
50
+ r.prototype.parse = function(t) { for (var i = this.plugins.length; i--;) this.plugins[i].onUpdate && (t = this.plugins[i].onUpdate(t, l) || t); for (new o(this).parse(t); this.stack.length;) this.popNode(); return this.nodes.length > 50 && a(this.nodes), this.nodes }, r.prototype.expose = function() {
51
+ for (var t = this.stack.length; t--;) {
52
+ var i = this.stack[t];
53
+ if (i.c || "a" === i.name || "video" === i.name || "audio" === i.name) return;
54
+ i.c = 1
55
+ }
56
+ }, r.prototype.hook = function(t) {
57
+ for (var i = this.plugins.length; i--;)
58
+ if (this.plugins[i].onParse && !1 === this.plugins[i].onParse(t, this)) return !1;
59
+ return !0
60
+ }, r.prototype.getUrl = function(t) { var i = this.options.domain; return "/" === t[0] ? "/" === t[1] ? t = (i ? i.split("://")[0] : "http") + ":" + t : i && (t = i + t) : !i || t.includes("data:") || t.includes("://") || (t = i + "/" + t), t }, r.prototype.parseStyle = function(t) {
61
+ var i = t.attrs,
62
+ e = (this.tagStyle[t.name] || "").split(";").concat((i.style || "").split(";")),
63
+ s = {},
64
+ n = "";
65
+ i.id && !this.xml && (this.options.useAnchor ? this.expose() : "img" !== t.name && "a" !== t.name && "video" !== t.name && "audio" !== t.name && (i.id = void 0)), i.width && (s.width = parseFloat(i.width) + (i.width.includes("%") ? "%" : "px"), i.width = void 0), i.height && (s.height = parseFloat(i.height) + (i.height.includes("%") ? "%" : "px"), i.height = void 0);
66
+ for (var a = 0, r = e.length; a < r; a++) {
67
+ var o = e[a].split(":");
68
+ if (!(o.length < 2)) {
69
+ var l = o.shift().trim().toLowerCase(),
70
+ h = o.join(":").trim();
71
+ if ("-" === h[0] && h.lastIndexOf("-") > 0 || h.includes("safe")) n += ";".concat(l, ":").concat(h);
72
+ else if (!s[l] || h.includes("import") || !s[l].includes("import")) {
73
+ if (h.includes("url")) {
74
+ var d = h.indexOf("(") + 1;
75
+ if (d) {
76
+ for (;
77
+ '"' === h[d] || "'" === h[d] || u[h[d]];) d++;
78
+ h = h.substr(0, d) + this.getUrl(h.substr(d))
79
+ }
80
+ } else h.includes("rpx") && (h = h.replace(/[0-9.]+\s*rpx/g, function(t) { return parseFloat(t) * c / 750 + "px" }));
81
+ s[l] = h
82
+ }
83
+ }
84
+ }
85
+ return t.attrs.style = n, s
86
+ }, r.prototype.onTagName = function(t) { this.tagName = this.xml ? t : t.toLowerCase(), "svg" === this.tagName && (this.xml = (this.xml || 0) + 1, l.ignoreTags.style = void 0) }, r.prototype.onAttrName = function(t) { t = this.xml ? t : t.toLowerCase(), "data-" === t.substr(0, 5) ? "data-src" !== t || this.attrs.src ? "img" === this.tagName || "a" === this.tagName ? this.attrName = t : this.attrName = void 0 : this.attrName = "src" : (this.attrName = t, this.attrs[t] = "T") }, r.prototype.onAttrVal = function(t) { var i = this.attrName || ""; "style" === i || "href" === i ? this.attrs[i] = n(t, !0) : i.includes("src") ? this.attrs[i] = this.getUrl(n(t, !0)) : i && (this.attrs[i] = t) }, r.prototype.onOpenTag = function(t) {
87
+ var i = Object.create(null);
88
+ i.name = this.tagName, i.attrs = this.attrs, this.attrs = Object.create(null);
89
+ var e = i.attrs,
90
+ s = this.stack[this.stack.length - 1],
91
+ n = s ? s.children : this.nodes,
92
+ a = this.xml ? t : l.voidTags[i.name];
93
+ if (h[i.name] && (e.class = h[i.name] + (e.class ? " " + e.class : "")), "embed" === i.name) {
94
+ var r = e.src || "";
95
+ r.includes(".mp4") || r.includes(".3gp") || r.includes(".m3u8") || (e.type || "").includes("video") ? i.name = "video" : (r.includes(".mp3") || r.includes(".wav") || r.includes(".aac") || r.includes(".m4a") || (e.type || "").includes("audio")) && (i.name = "audio"), e.autostart && (e.autoplay = "T"), e.controls = "T"
96
+ }
97
+ if ("video" !== i.name && "audio" !== i.name || ("video" !== i.name || e.id || (e.id = "v" + f++), e.controls || e.autoplay || (e.controls = "T"), i.src = [], e.src && (i.src.push(e.src), e.src = void 0), this.expose()), a) {
98
+ if (!this.hook(i) || l.ignoreTags[i.name]) return void("base" !== i.name || this.options.domain ? "source" === i.name && s && ("video" === s.name || "audio" === s.name) && e.src && s.src.push(e.src) : this.options.domain = e.href);
99
+ var o = this.parseStyle(i);
100
+ if ("img" === i.name) {
101
+ if (e.src && (e.src.includes("webp") && (i.webp = "T"), e.src.includes("data:") && "all" !== this.options.previewImg && !e["original-src"] && (e.ignore = "T"), !e.ignore || i.webp || e.src.includes("cloud://"))) {
102
+ for (var d = this.stack.length; d--;) {
103
+ var p = this.stack[d];
104
+ "table" !== p.name || i.webp || e.src.includes("cloud://") || (!o.display || o.display.includes("inline") ? i.t = "inline-block" : i.t = o.display, o.display = void 0);
105
+ var u = p.attrs.style || "";
106
+ if (!u.includes("flex:") || u.includes("flex:0") || u.includes("flex: 0") || o.width && !(parseInt(o.width) > 100))
107
+ if (u.includes("flex") && "100%" === o.width)
108
+ for (var g = d + 1; g < this.stack.length; g++) { var m = this.stack[g].attrs.style || ""; if (!m.includes(";width") && !m.includes(" width") && 0 !== m.indexOf("width")) { o.width = ""; break } } else u.includes("inline-block") && (o.width && "%" === o.width[o.width.length - 1] ? (p.attrs.style += ";max-width:" + o.width, o.width = "") : p.attrs.style += ";max-width:100%");
109
+ else { o.width = "100% !important", o.height = ""; for (var v = d + 1; v < this.stack.length; v++) this.stack[v].attrs.style = (this.stack[v].attrs.style || "").replace("inline-", "") }
110
+ "a" === p.name ? i.a = p.attrs : p.c = 1
111
+ }
112
+ i.i = this.imgList.length;
113
+ var y = e["original-src"] || e.src;
114
+ if (this.imgList.includes(y)) {
115
+ var b = y.indexOf("://");
116
+ if (-1 !== b) {
117
+ b += 3;
118
+ for (var x = y.substr(0, b); b < y.length && "/" !== y[b]; b++) x += Math.random() > .5 ? y[b].toUpperCase() : y[b];
119
+ x += y.substr(b), y = x
120
+ }
121
+ }
122
+ this.imgList.push(y), i.t || (this.imgList._unloadimgs += 1)
123
+ }
124
+ "inline" === o.display && (o.display = ""), e.ignore && (o["max-width"] = o["max-width"] || "100%", e.style += ";-webkit-touch-callout:none"), parseInt(o.width) > c && (o.height = void 0), isNaN(parseInt(o.width)) || (i.w = "T"), !isNaN(parseInt(o.height)) && (!o.height.includes("%") || s && (s.attrs.style || "").includes("height")) && (i.h = "T"), i.w && i.h && o["object-fit"] && ("contain" === o["object-fit"] ? i.m = "aspectFit" : "cover" === o["object-fit"] && (i.m = "aspectFill"))
125
+ } else if ("svg" === i.name) return n.push(i), this.stack.push(i), void this.popNode();
126
+ for (var w in o) o[w] && (e.style += ";".concat(w, ":").concat(o[w].replace(" !important", "")));
127
+ e.style = e.style.substr(1) || void 0
128
+ } else("pre" === i.name || (e.style || "").includes("white-space") && e.style.includes("pre")) && 2 !== this.pre && (this.pre = i.pre = 1), i.children = [], this.stack.push(i);
129
+ n.push(i)
130
+ }, r.prototype.onCloseTag = function(t) {
131
+ t = this.xml ? t : t.toLowerCase();
132
+ var i;
133
+ for (i = this.stack.length; i-- && this.stack[i].name !== t;);
134
+ if (-1 !== i)
135
+ for (; this.stack.length > i;) this.popNode();
136
+ else if ("p" === t || "br" === t) {
137
+ var e = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
138
+ e.push({ name: t, attrs: { class: h[t], style: this.tagStyle[t] } })
139
+ }
140
+ }, r.prototype.popNode = function() {
141
+ var i = this.stack.pop(),
142
+ e = i.attrs,
143
+ s = i.children,
144
+ n = this.stack[this.stack.length - 1],
145
+ r = n ? n.children : this.nodes;
146
+ if (!this.hook(i) || l.ignoreTags[i.name]) return "title" === i.name && s.length && "text" === s[0].type && this.options.setTitle && tt.setNavigationBarTitle({ title: s[0].text }), void r.pop();
147
+ if (i.pre && 2 !== this.pre) { this.pre = i.pre = void 0; for (var o = this.stack.length; o--;) this.stack[o].pre && (this.pre = 1) }
148
+ if ("svg" === i.name) {
149
+ if (this.xml > 1) return void this.xml--;
150
+ var h = "",
151
+ d = e.style;
152
+ return e.style = "", e.xmlns = "http://www.w3.org/2000/svg",
153
+ function i(e) {
154
+ if ("text" === e.type) return void(h += e.text);
155
+ var s = l.svgDict[e.name] || e.name;
156
+ if ("foreignObject" === s) { var n, a = t(e.children || []); try { for (a.s(); !(n = a.n()).done;) { var r = n.value; if (r.attrs && !r.attrs.xmlns) { r.attrs.xmlns = "http://www.w3.org/1999/xhtml"; break } } } catch (t) { a.e(t) } finally { a.f() } } h += "<" + s;
157
+ for (var o in e.attrs) {
158
+ var c = e.attrs[o];
159
+ c && (h += " ".concat(l.svgDict[o] || o, '="').concat(c.replace(/"/g, ""), '"'))
160
+ }
161
+ if (e.children) {
162
+ h += ">";
163
+ for (var d = 0; d < e.children.length; d++) i(e.children[d]);
164
+ h += "</" + s + ">"
165
+ } else h += "/>"
166
+ }(i), i.name = "img", i.attrs = { src: "data:image/svg+xml;utf8," + h.replace(/#/g, "%23"), style: d, ignore: "T" }, i.children = void 0, this.xml = !1, void(l.ignoreTags.style = !0)
167
+ }
168
+ var p = {};
169
+ if (e.align && ("table" === i.name ? "center" === e.align ? p["margin-inline-start"] = p["margin-inline-end"] = "auto" : p.float = e.align : p["text-align"] = e.align, e.align = void 0), e.dir && (p.direction = e.dir, e.dir = void 0), "font" === i.name && (e.color && (p.color = e.color, e.color = void 0), e.face && (p["font-family"] = e.face, e.face = void 0), e.size)) {
170
+ var u = parseInt(e.size);
171
+ isNaN(u) || (u < 1 ? u = 1 : u > 7 && (u = 7), p["font-size"] = ["x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large"][u - 1]), e.size = void 0
172
+ }
173
+ if ((e.class || "").includes("align-center") && (p["text-align"] = "center"), Object.assign(p, this.parseStyle(i)), "table" !== i.name && parseInt(p.width) > c && (p["max-width"] = "100%", p["box-sizing"] = "border-box"), l.blockTags[i.name]) i.name = "div";
174
+ else if (l.trustTags[i.name] || this.xml)
175
+ if ("a" === i.name || "ad" === i.name) this.expose();
176
+ else if ("video" === i.name || "audio" === i.name)(p.height || "").includes("auto") && (p.height = void 0), i.children = void 0;
177
+ else if ("ul" !== i.name && "ol" !== i.name || !i.c)
178
+ if ("table" === i.name) {
179
+ var f = parseFloat(e.cellpadding),
180
+ g = parseFloat(e.cellspacing),
181
+ m = parseFloat(e.border),
182
+ v = p["border-color"],
183
+ y = p["border-style"];
184
+ if (i.c && (isNaN(f) && (f = 2), isNaN(g) && (g = 2)), m && (e.style += ";border:".concat(m, "px ").concat(y || "solid", " ").concat(v || "gray")), i.flag && i.c) {
185
+ i.flag = void 0, p.display = "grid", "collapse" === p["border-collapse"] && (p["border-collapse"] = void 0, g = 0), g ? (p["grid-gap"] = g + "px", p.padding = g + "px") : m && (e.style += ";border-left:0;border-top:0");
186
+ var b = [],
187
+ x = [],
188
+ w = [],
189
+ k = {};
190
+ ! function i(e) {
191
+ for (var s = 0; s < e.length; s++)
192
+ if ("tr" === e[s].name) x.push(e[s]);
193
+ else if ("colgroup" === e[s].name) {
194
+ var n, a = 1,
195
+ r = t(e[s].children || []);
196
+ try {
197
+ for (r.s(); !(n = r.n()).done;) {
198
+ var o = n.value;
199
+ if ("col" === o.name) {
200
+ var l = o.attrs.style || "",
201
+ h = l.indexOf("width") ? l.indexOf(";width") : 0;
202
+ if (-1 !== h) { var c = l.indexOf(";", h + 6); - 1 === c && (c = l.length), b[a] = l.substring(h ? h + 7 : 6, c) } a += 1
203
+ }
204
+ }
205
+ } catch (t) { r.e(t) } finally { r.f() }
206
+ } else i(e[s].children || [])
207
+ }(s);
208
+ for (var N = 1; N <= x.length; N++) {
209
+ for (var T = 1, O = 0; O < x[N - 1].children.length; O++) {
210
+ var j = x[N - 1].children[O];
211
+ if ("td" === j.name || "th" === j.name) {
212
+ for (; k[N + "." + T];) T++;
213
+ j.c = 1;
214
+ var S = j.attrs.style || "",
215
+ C = S.indexOf("width") ? S.indexOf(";width") : 0;
216
+ if (-1 !== C) { var A = S.indexOf(";", C + 6); - 1 === A && (A = S.length), j.attrs.colspan || (b[T] = S.substring(C ? C + 7 : 6, A)), S = S.substr(0, C) + S.substr(A) }
217
+ if (S += ";display:flex;flex-direction:column", -1 !== (C = S.indexOf("vertical-align"))) {
218
+ var I = S.substr(C + 15, 10);
219
+ I.includes("middle") ? S += ";justify-content:center" : I.includes("bottom") && (S += ";justify-content:flex-end")
220
+ } else S += ";justify-content:center";
221
+ if (-1 !== (C = S.indexOf("text-align"))) {
222
+ var L = S.substr(C + 11, 10);
223
+ L.includes("center") ? S += ";justify-content: center" : L.includes("right") && (S += ";justify-content: right")
224
+ }
225
+ if (S = (m ? ";border:".concat(m, "px ").concat(y || "solid", " ").concat(v || "gray") + (g ? "" : ";border-right:0;border-bottom:0") : "") + (f ? ";padding:".concat(f, "px") : "") + ";" + S, j.attrs.colspan && (S += ";grid-column-start:".concat(T, ";grid-column-end:").concat(T + parseInt(j.attrs.colspan)), j.attrs.rowspan || (S += ";grid-row-start:".concat(N, ";grid-row-end:").concat(N + 1)), T += parseInt(j.attrs.colspan) - 1), j.attrs.rowspan) {
226
+ S += ";grid-row-start:".concat(N, ";grid-row-end:").concat(N + parseInt(j.attrs.rowspan)), j.attrs.colspan || (S += ";grid-column-start:".concat(T, ";grid-column-end:").concat(T + 1));
227
+ for (var z = 1; z < j.attrs.rowspan; z++)
228
+ for (var F = 0; F < (j.attrs.colspan || 1); F++) k[N + z + "." + (T - F)] = 1
229
+ }
230
+ S && (j.attrs.style = S), w.push(j), T++
231
+ }
232
+ }
233
+ if (1 === N) {
234
+ for (var q = "", U = 1; U < T; U++) q += (b[U] ? b[U] : "auto") + " ";
235
+ p["grid-template-columns"] = q
236
+ }
237
+ }
238
+ i.children = w
239
+ } else i.c && (p.display = "table"), isNaN(g) || (p["border-spacing"] = g + "px"), (m || f || i.c) && function t(e) {
240
+ for (var s = 0; s < e.length; s++) {
241
+ var n = e[s];
242
+ i.c && (n.c = 1), "th" === n.name || "td" === n.name ? (m && (n.attrs.style = "border:".concat(m, "px ").concat(y || "solid", " ").concat(v || "gray", ";").concat(n.attrs.style || "")), f && (n.attrs.style = "padding:".concat(f, "px;").concat(n.attrs.style || ""))) : n.children && t(n.children)
243
+ }
244
+ }(s);
245
+ if (this.options.scrollTable && !(e.style || "").includes("inline")) {
246
+ var V = Object.assign({}, i);
247
+ i.name = "div", i.attrs = { style: "overflow-x:auto;padding:1px" }, i.children = [V], e = V.attrs
248
+ }
249
+ } else if (("tbody" === i.name || "tr" === i.name) && i.flag && i.c) i.flag = void 0,
250
+ function t(i) {
251
+ for (var e = 0; e < i.length; e++)
252
+ if ("td" === i[e].name)
253
+ for (var s = 0, n = ["color", "background", "background-color"]; s < n.length; s++) {
254
+ var a = n[s];
255
+ p[a] && (i[e].attrs.style = a + ":" + p[a] + ";" + (i[e].attrs.style || ""))
256
+ } else t(i[e].children || [])
257
+ }(s);
258
+ else if ("td" !== i.name && "th" !== i.name || !e.colspan && !e.rowspan) { if ("ruby" === i.name) { i.name = "span"; for (var D = 0; D < s.length - 1; D++) "text" === s[D].type && "rt" === s[D + 1].name && (s[D] = { name: "span", attrs: { style: "display:inline-block;text-align:center" }, children: [{ name: "div", attrs: { style: "font-size:50%;" + (s[D + 1].attrs.style || "") }, children: s[D + 1].children }, s[D]] }, s.splice(D + 1, 1)) } } else
259
+ for (var B = this.stack.length; B--;) "table" !== this.stack[B].name && "tbody" !== this.stack[B].name && "tr" !== this.stack[B].name || (this.stack[B].flag = 1);
260
+ else {
261
+ var M = { a: "lower-alpha", A: "upper-alpha", i: "lower-roman", I: "upper-roman" };
262
+ M[e.type] && (e.style += ";list-style-type:" + M[e.type], e.type = void 0), i.c = 1;
263
+ for (var P = s.length; P--;) "li" === s[P].name && (s[P].c = 1)
264
+ } else i.name = "span";
265
+ if ((p.display || "").includes("flex") && !i.c)
266
+ for (var Z = s.length; Z--;) {
267
+ var _ = s[Z];
268
+ _.f && (_.attrs.style = (_.attrs.style || "") + _.f, _.f = void 0)
269
+ }
270
+ var E = n && ((n.attrs.style || "").includes("flex") || (n.attrs.style || "").includes("grid")) && !i.c;
271
+ E && (i.f = ";max-width:100%"), s.length >= 50 && i.c && !(p.display || "").includes("flex") && a(s);
272
+ for (var G in p)
273
+ if (p[G]) {
274
+ var W = ";".concat(G, ":").concat(p[G].replace(" !important", ""));
275
+ E && (G.includes("flex") && "flex-direction" !== G || "align-self" === G || G.includes("grid") || "-" === p[G][0] || G.includes("width") && W.includes("%")) ? (i.f += W, "width" === G && (e.style += ";width:100%")) : e.style += W
276
+ } e.style = e.style.substr(1) || void 0
277
+ }, r.prototype.onText = function(t) {
278
+ if (!this.pre) {
279
+ for (var i, e = "", s = 0, a = t.length; s < a; s++) u[t[s]] ? (" " !== e[e.length - 1] && (e += " "), "\n" !== t[s] || i || (i = !0)) : e += t[s];
280
+ if (" " === e && i) return;
281
+ t = e
282
+ }
283
+ var r = Object.create(null);
284
+ if (r.type = "text", r.text = n(t), this.hook(r)) {
285
+ (this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes).push(r)
286
+ }
287
+ }, o.prototype.parse = function(t) { this.content = t || "", this.i = 0, this.start = 0, this.state = this.text; for (var i = this.content.length; - 1 !== this.i && this.i < i;) this.state() }, o.prototype.checkClose = function(t) { var i = "/" === this.content[this.i]; return !!(">" === this.content[this.i] || i && ">" === this.content[this.i + 1]) && (t && this.handler[t](this.content.substring(this.start, this.i)), this.i += i ? 2 : 1, this.start = this.i, this.handler.onOpenTag(i), "script" === this.handler.tagName ? (this.i = this.content.indexOf("</", this.i), -1 !== this.i && (this.i += 2, this.start = this.i), this.state = this.endTag) : this.state = this.text, !0) }, o.prototype.text = function() {
288
+ if (this.i = this.content.indexOf("<", this.i), -1 === this.i) return void(this.start < this.content.length && this.handler.onText(this.content.substring(this.start, this.content.length)));
289
+ var t = this.content[this.i + 1];
290
+ if (t >= "a" && t <= "z" || t >= "A" && t <= "Z") this.start !== this.i && this.handler.onText(this.content.substring(this.start, this.i)), this.start = ++this.i, this.state = this.tagName;
291
+ else if ("/" === t || "!" === t || "?" === t) { this.start !== this.i && this.handler.onText(this.content.substring(this.start, this.i)); var i = this.content[this.i + 2]; if ("/" === t && (i >= "a" && i <= "z" || i >= "A" && i <= "Z")) return this.i += 2, this.start = this.i, void(this.state = this.endTag); var e = "--\x3e"; "!" === t && "-" === this.content[this.i + 2] && "-" === this.content[this.i + 3] || (e = ">"), this.i = this.content.indexOf(e, this.i), -1 !== this.i && (this.i += e.length, this.start = this.i) } else this.i++
292
+ }, o.prototype.tagName = function() {
293
+ if (u[this.content[this.i]]) {
294
+ for (this.handler.onTagName(this.content.substring(this.start, this.i)); u[this.content[++this.i]];);
295
+ this.i < this.content.length && !this.checkClose() && (this.start = this.i, this.state = this.attrName)
296
+ } else this.checkClose("onTagName") || this.i++
297
+ }, o.prototype.attrName = function() {
298
+ var t = this.content[this.i];
299
+ if (u[t] || "=" === t) {
300
+ this.handler.onAttrName(this.content.substring(this.start, this.i));
301
+ for (var i = "=" === t, e = this.content.length; ++this.i < e;)
302
+ if (t = this.content[this.i], !u[t]) {
303
+ if (this.checkClose()) return;
304
+ if (i) return this.start = this.i, void(this.state = this.attrVal);
305
+ if ("=" !== this.content[this.i]) return this.start = this.i, void(this.state = this.attrName);
306
+ i = !0
307
+ }
308
+ } else this.checkClose("onAttrName") || this.i++
309
+ }, o.prototype.attrVal = function() {
310
+ var t = this.content[this.i],
311
+ i = this.content.length;
312
+ if ('"' === t || "'" === t) {
313
+ if (this.start = ++this.i, this.i = this.content.indexOf(t, this.i), -1 === this.i) return;
314
+ this.handler.onAttrVal(this.content.substring(this.start, this.i))
315
+ } else
316
+ for (; this.i < i; this.i++) { if (u[this.content[this.i]]) { this.handler.onAttrVal(this.content.substring(this.start, this.i)); break } if (this.checkClose("onAttrVal")) return }
317
+ for (; u[this.content[++this.i]];);
318
+ this.i < i && !this.checkClose() && (this.start = this.i, this.state = this.attrName)
319
+ }, o.prototype.endTag = function() {
320
+ var t = this.content[this.i];
321
+ if (u[t] || ">" === t || "/" === t) {
322
+ if (this.handler.onCloseTag(this.content.substring(this.start, this.i)), ">" !== t && (this.i = this.content.indexOf(">", this.i), -1 === this.i)) return;
323
+ this.start = ++this.i, this.state = this.text
324
+ } else this.i++
325
+ }, module.exports = r;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ function e(e, t, n) { return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e }
4
+ /*!
5
+ * mp-html v2.5.1
6
+ * https://github.com/jin-yufeng/mp-html
7
+ *
8
+ * Released under the MIT license
9
+ * Author: Jin Yufeng
10
+ */
11
+ var t = require("./parser"),
12
+ n = [];
13
+ Component({
14
+ data: { nodes: [] },
15
+ properties: { containerStyle: String, content: { type: String, value: "", observer: function(e) { this.setContent(e) } }, copyLink: { type: Boolean, value: !0 }, domain: String, errorImg: String, lazyLoad: Boolean, loadingImg: String, pauseVideo: { type: Boolean, value: !0 }, previewImg: { type: null, value: !0 }, scrollTable: Boolean, selectable: null, setTitle: { type: Boolean, value: !0 }, showImgMenu: { type: Boolean, value: !0 }, tagStyle: Object, useAnchor: null },
16
+ created: function() { this.plugins = []; for (var e = n.length; e--;) this.plugins.push(new n[e](this)) },
17
+ detached: function() { this._hook("onDetached") },
18
+ methods: {
19
+ in: function(e, t, n) { e && t && n && (this._in = { page: e, selector: t, scrollTop: n }) },
20
+ navigateTo: function(t, n) {
21
+ var i = this;
22
+ return new Promise(function(o, r) {
23
+ if (!i.data.useAnchor) return void r(Error("Anchor is disabled"));
24
+ var a = tt.createSelectorQuery().in(i._in ? i._in.page : i).select((i._in ? i._in.selector : "._root") + (t ? "".concat(">>>", "#").concat(t) : "")).boundingClientRect();
25
+ i._in ? a.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect() : a.selectViewport().scrollOffset(), a.exec(function(t) {
26
+ if (!t[0]) return void r(Error("Label not found"));
27
+ var a = t[1].scrollTop + t[0].top - (t[2] ? t[2].top : 0) + (n || parseInt(i.data.useAnchor) || 0);
28
+ i._in ? i._in.page.setData(e({}, i._in.scrollTop, a)) : tt.pageScrollTo({ scrollTop: a, duration: 300 }), o()
29
+ })
30
+ })
31
+ },
32
+ getText: function(e) {
33
+ var t = "";
34
+ return function e(n) {
35
+ for (var i = 0; i < n.length; i++) {
36
+ var o = n[i];
37
+ if ("text" === o.type) t += o.text.replace(/&amp;/g, "&");
38
+ else if ("br" === o.name) t += "\n";
39
+ else {
40
+ var r = "p" === o.name || "div" === o.name || "tr" === o.name || "li" === o.name || "h" === o.name[0] && o.name[1] > "0" && o.name[1] < "7";
41
+ r && t && "\n" !== t[t.length - 1] && (t += "\n"), o.children && e(o.children), r && "\n" !== t[t.length - 1] ? t += "\n" : "td" !== o.name && "th" !== o.name || (t += "\t")
42
+ }
43
+ }
44
+ }(e || this.data.nodes), t
45
+ },
46
+ getRect: function() { var e = this; return new Promise(function(t, n) { tt.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e) { return e[0] ? t(e[0]) : n(Error("Root label not found")) }) }) },
47
+ pauseMedia: function() { for (var e = (this._videos || []).length; e--;) this._videos[e].pause() },
48
+ setPlaybackRate: function(e) { this.playbackRate = e; for (var t = (this._videos || []).length; t--;) this._videos[t].playbackRate(e) },
49
+ setContent: function(e, n) {
50
+ var i = this;
51
+ this.imgList && n || (this.imgList = []), this._videos = [];
52
+ var o = {},
53
+ r = new t(this).parse(e);
54
+ if (n)
55
+ for (var a = this.data.nodes.length, s = r.length; s--;) o["nodes[".concat(a + s, "]")] = r[s];
56
+ else o.nodes = r;
57
+ if (this.setData(o), this.selectComponent("#_root", function(e) { e.root = i, i._hook("onLoad"), i.triggerEvent("load") }), this.data.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) {
58
+ var l = 0,
59
+ c = function e(t) { t && t.height || (t = {}), t.height === l ? i.triggerEvent("ready", t) : (l = t.height, setTimeout(() => { i.getRect().then(e).catch(e) }, 350)) };
60
+ this.getRect().then(c).catch(c)
61
+ } else this.imgList._unloadimgs || this.getRect().then(function(e) { i.triggerEvent("ready", e) }).catch(function() { i.triggerEvent("ready", {}) })
62
+ },
63
+ _hook: function(e) { for (var t = n.length; t--;) this.plugins[t][e] && this.plugins[t][e]() }
64
+ }
65
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "component": false,
3
+ "usingComponents": {
4
+ "node": "./node/node"
5
+ }
6
+
7
+ }
@@ -0,0 +1,4 @@
1
+ <view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}">
2
+ <slot tt:if="{{!nodes[0]}}" />
3
+ <node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" />
4
+ </view>
@@ -0,0 +1,11 @@
1
+ ._root {
2
+ padding: 1px 0;
3
+ overflow-x: auto;
4
+ overflow-y: hidden;
5
+ -webkit-overflow-scrolling: touch
6
+ }
7
+
8
+ ._select {
9
+ -webkit-user-select: text;
10
+ user-select: text
11
+ }