@taole/dev-helper 0.0.26 → 0.0.28
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/dist/open-diandian.umd.js +14 -49
- package/open-diandian/index.js +11 -42
- package/package.json +1 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
(function (
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
1
|
+
(function (factory) {
|
|
3
2
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
-
|
|
5
|
-
})(
|
|
3
|
+
factory();
|
|
4
|
+
})((function () { 'use strict';
|
|
6
5
|
|
|
7
|
-
const name = 'open-diandian';
|
|
8
6
|
// 测试使用open-diandain-app标签
|
|
9
7
|
// TODO: 后期可以考虑优化为根据域名自动选择appid
|
|
10
8
|
function defineTag() {
|
|
@@ -12,6 +10,7 @@
|
|
|
12
10
|
"open-diandain-app",
|
|
13
11
|
class extends HTMLElement {
|
|
14
12
|
static get observedAttributes() {
|
|
13
|
+
// 后期考虑去掉fallback_link_ios和fallback_link_android
|
|
15
14
|
return ['appid', 'extinfo', 'fallback_link_ios', 'fallback_link_android'];
|
|
16
15
|
}
|
|
17
16
|
constructor() {
|
|
@@ -84,34 +83,11 @@
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
_handleAlinkClick() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
let isPageHide = false;
|
|
94
|
-
this._pagehideCallback = this._pagehideCallback || function () {
|
|
95
|
-
// console.log("visibilitychange called", document.hidden, Date.now() - nowTs);
|
|
96
|
-
if (document.hidden) {
|
|
97
|
-
isPageHide = true;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
window.removeEventListener("visibilitychange", this._pagehideCallback);
|
|
101
|
-
window.addEventListener("visibilitychange", this._pagehideCallback);
|
|
102
|
-
this._alink_click_timer = setTimeout(() => {
|
|
103
|
-
window.removeEventListener("visibilitychange", this._pagehideCallback);
|
|
104
|
-
setTimeout(() => {
|
|
105
|
-
// console.log("3s到了22", isPageHide, Date.now() - nowTs);
|
|
106
|
-
// console.log("document.hasFocus()", document.hasFocus());
|
|
107
|
-
if (isPageHide || document.hasFocus()) return;
|
|
108
|
-
this._alink_click_timer = null;
|
|
109
|
-
// window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
|
|
110
|
-
var tmplnk = document.createElement("a");
|
|
111
|
-
tmplnk.href = this._alink_fallback;
|
|
112
|
-
tmplnk.click();
|
|
113
|
-
}, 30);
|
|
114
|
-
}, 3000);
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
var tmplnk = document.createElement("a");
|
|
88
|
+
tmplnk.href = this._alink_fallback;
|
|
89
|
+
tmplnk.click();
|
|
90
|
+
}, 1000);
|
|
115
91
|
}
|
|
116
92
|
disconnectedCallback() {
|
|
117
93
|
if (this._openAppTag) {
|
|
@@ -144,7 +120,7 @@
|
|
|
144
120
|
if (this._isIOS) {
|
|
145
121
|
this._alink_fallback = 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939';
|
|
146
122
|
} else {
|
|
147
|
-
this._alink_fallback = "https://
|
|
123
|
+
this._alink_fallback = "https://m.malink.cn/s/rYNfAj";
|
|
148
124
|
}
|
|
149
125
|
} else {
|
|
150
126
|
if (this._isIOS) {
|
|
@@ -172,18 +148,10 @@
|
|
|
172
148
|
} else if (isTxc) {
|
|
173
149
|
if (this._isAndroid) {
|
|
174
150
|
this._alink.href = "tuxiaochan://diandain:8888/splash";
|
|
175
|
-
// setTimeout(() => {
|
|
176
|
-
// window.location.href = "market://details?id=com.tuwan.txc";
|
|
177
|
-
// setTimeout(() => {
|
|
178
|
-
// window.location.href =
|
|
179
|
-
// "https://sj.qq.com/myapp/detail.htm?apkName=com.tuwan.txc";
|
|
180
|
-
// }, 200);
|
|
181
|
-
// }, 200);
|
|
182
151
|
} else if (this._isIOS) { // ios 跳转appstore
|
|
183
|
-
// window.location.href = 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939';
|
|
184
152
|
this._alink.href = 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939';
|
|
185
153
|
} else {
|
|
186
|
-
this._alink.href = "https://
|
|
154
|
+
this._alink.href = "https://m.malink.cn/s/rYNfAj";
|
|
187
155
|
}
|
|
188
156
|
}
|
|
189
157
|
}
|
|
@@ -202,11 +170,8 @@
|
|
|
202
170
|
|
|
203
171
|
registerTdiv();
|
|
204
172
|
|
|
205
|
-
//
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
return index;
|
|
173
|
+
// export default {
|
|
174
|
+
// name
|
|
175
|
+
// }
|
|
211
176
|
|
|
212
177
|
}));
|
package/open-diandian/index.js
CHANGED
|
@@ -6,6 +6,7 @@ function defineTag() {
|
|
|
6
6
|
"open-diandain-app",
|
|
7
7
|
class extends HTMLElement {
|
|
8
8
|
static get observedAttributes() {
|
|
9
|
+
// 后期考虑去掉fallback_link_ios和fallback_link_android
|
|
9
10
|
return ['appid', 'extinfo', 'fallback_link_ios', 'fallback_link_android'];
|
|
10
11
|
}
|
|
11
12
|
constructor() {
|
|
@@ -78,34 +79,11 @@ function defineTag() {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
_handleAlinkClick() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
let isPageHide = false;
|
|
88
|
-
this._pagehideCallback = this._pagehideCallback || function () {
|
|
89
|
-
// console.log("visibilitychange called", document.hidden, Date.now() - nowTs);
|
|
90
|
-
if (document.hidden) {
|
|
91
|
-
isPageHide = true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
window.removeEventListener("visibilitychange", this._pagehideCallback);
|
|
95
|
-
window.addEventListener("visibilitychange", this._pagehideCallback);
|
|
96
|
-
this._alink_click_timer = setTimeout(() => {
|
|
97
|
-
window.removeEventListener("visibilitychange", this._pagehideCallback);
|
|
98
|
-
setTimeout(() => {
|
|
99
|
-
// console.log("3s到了22", isPageHide, Date.now() - nowTs);
|
|
100
|
-
// console.log("document.hasFocus()", document.hasFocus());
|
|
101
|
-
if (isPageHide || document.hasFocus()) return;
|
|
102
|
-
this._alink_click_timer = null;
|
|
103
|
-
// window.location.href = this._alink_fallback; // 直接重定向的话ios上没法去到appstore
|
|
104
|
-
var tmplnk = document.createElement("a");
|
|
105
|
-
tmplnk.href = this._alink_fallback;
|
|
106
|
-
tmplnk.click();
|
|
107
|
-
}, 30);
|
|
108
|
-
}, 3000);
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
var tmplnk = document.createElement("a");
|
|
84
|
+
tmplnk.href = this._alink_fallback;
|
|
85
|
+
tmplnk.click();
|
|
86
|
+
}, 1000);
|
|
109
87
|
}
|
|
110
88
|
disconnectedCallback() {
|
|
111
89
|
if (this._openAppTag) {
|
|
@@ -138,7 +116,7 @@ function defineTag() {
|
|
|
138
116
|
if (this._isIOS) {
|
|
139
117
|
this._alink_fallback = 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939';
|
|
140
118
|
} else {
|
|
141
|
-
this._alink_fallback = "https://
|
|
119
|
+
this._alink_fallback = "https://m.malink.cn/s/rYNfAj";
|
|
142
120
|
}
|
|
143
121
|
} else {
|
|
144
122
|
if (this._isIOS) {
|
|
@@ -166,18 +144,10 @@ function defineTag() {
|
|
|
166
144
|
} else if (isTxc) {
|
|
167
145
|
if (this._isAndroid) {
|
|
168
146
|
this._alink.href = "tuxiaochan://diandain:8888/splash";
|
|
169
|
-
// setTimeout(() => {
|
|
170
|
-
// window.location.href = "market://details?id=com.tuwan.txc";
|
|
171
|
-
// setTimeout(() => {
|
|
172
|
-
// window.location.href =
|
|
173
|
-
// "https://sj.qq.com/myapp/detail.htm?apkName=com.tuwan.txc";
|
|
174
|
-
// }, 200);
|
|
175
|
-
// }, 200);
|
|
176
147
|
} else if (this._isIOS) { // ios 跳转appstore
|
|
177
|
-
// window.location.href = 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939';
|
|
178
148
|
this._alink.href = 'https://apps.apple.com/us/app/%E5%85%94%E5%B0%8F%E9%93%B2/id6745920939';
|
|
179
149
|
} else {
|
|
180
|
-
this._alink.href = "https://
|
|
150
|
+
this._alink.href = "https://m.malink.cn/s/rYNfAj";
|
|
181
151
|
}
|
|
182
152
|
}
|
|
183
153
|
}
|
|
@@ -196,7 +166,6 @@ function registerTdiv() {
|
|
|
196
166
|
|
|
197
167
|
registerTdiv();
|
|
198
168
|
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
169
|
+
// export default {
|
|
170
|
+
// name
|
|
171
|
+
// }
|