emacroh5lib 1.0.87 → 1.0.89
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/emacroh5lib.min.js +1 -1
- package/dist/emacroh5lib.min.js.LICENSE.txt +4 -0
- package/package.json +1 -1
- package/src/utilities/E9ChartUtils.js +12 -13
- package/src/utilities/EMacro.ts +263 -250
- package/src/utilities/TaskScheduler.js +1 -0
- package/src/views/TestView/index.less +1 -0
- package/src/views/TestView/index.vue +385 -282
- package/tsconfig.json +2 -2
- package/dist/aaa/A.mtl +0 -103
- package/dist/aaa/A.obj +0 -450053
@@ -36,6 +36,10 @@ Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
36
36
|
version 0.6.9
|
37
37
|
*/
|
38
38
|
|
39
|
+
/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */
|
40
|
+
|
41
|
+
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
42
|
+
|
39
43
|
/**
|
40
44
|
* vue-class-component v7.2.3
|
41
45
|
* (c) 2015-present Evan You
|
package/package.json
CHANGED
@@ -8,13 +8,12 @@
|
|
8
8
|
* interval 轮播时间间隔,单位毫秒,默认为2000
|
9
9
|
* loopSeries boolean类型,默认为false。
|
10
10
|
* true表示循环所有series的tooltip,false则显示指定seriesIndex的tooltip
|
11
|
-
*
|
12
|
-
* 当loopSeries为true时,从seriesIndex系列开始执行.
|
11
|
+
* seriesIndex 默认为0,指定某个系列(option中的series索引)循环显示tooltip, 当loopSeries为true时,从seriesIndex系列开始执行.
|
13
12
|
* }
|
14
13
|
* @returns {{clearLoop: clearLoop}}
|
15
14
|
*/
|
16
15
|
const loopShowTooltip = function (chart, chartOption, options) {
|
17
|
-
|
16
|
+
let defaultOptions = {
|
18
17
|
interval: 3000,
|
19
18
|
loopSeries: true,
|
20
19
|
seriesIndex: 0,
|
@@ -28,13 +27,13 @@ const loopShowTooltip = function (chart, chartOption, options) {
|
|
28
27
|
chartOption = chart.getOption();
|
29
28
|
}
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
let dataIndex = 0; // 数据索引,初始化为-1,是为了判断是否是第一次执行
|
31
|
+
let seriesIndex = 0; // 系列索引
|
32
|
+
let timeTicket = 0;
|
33
|
+
let seriesLen = chartOption.series.length; // 系列个数
|
34
|
+
let dataLen = 0; // 某个系列数据个数
|
35
|
+
let chartType; // 系列类型
|
36
|
+
let first = true;
|
38
37
|
|
39
38
|
// 不循环series时seriesIndex指定显示tooltip的系列,不指定默认为0,指定多个则默认为第一个
|
40
39
|
// 循环series时seriesIndex指定循环的series,不指定则从0开始循环所有series,指定单个则相当于不循环,指定多个
|
@@ -68,11 +67,11 @@ const loopShowTooltip = function (chart, chartOption, options) {
|
|
68
67
|
chart.setOption(chartOption);
|
69
68
|
}
|
70
69
|
|
71
|
-
|
70
|
+
let series = chartOption.series;
|
72
71
|
chartType = series[seriesIndex].type; // 系列类型
|
73
72
|
dataLen = series[seriesIndex].data.length; // 某个系列的数据个数
|
74
73
|
|
75
|
-
|
74
|
+
let tipParams = { seriesIndex: seriesIndex };
|
76
75
|
switch (chartType) {
|
77
76
|
case 'map':
|
78
77
|
case 'pie':
|
@@ -146,7 +145,7 @@ const loopShowTooltip = function (chart, chartOption, options) {
|
|
146
145
|
}
|
147
146
|
}
|
148
147
|
|
149
|
-
|
148
|
+
const zRender = chart.getZr();
|
150
149
|
|
151
150
|
function zRenderMouseMove(param) {
|
152
151
|
if (param.event) {
|
package/src/utilities/EMacro.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
import XLSX from "xlsx";
|
2
|
+
import * as XLSX from "xlsx";
|
3
3
|
// import XLSX from "./dist/xlsx.js";
|
4
|
-
|
4
|
+
|
5
5
|
|
6
6
|
// const XLSX = require("./dist/xlsx.js")
|
7
7
|
import BMF from 'browser-md5-file';
|
@@ -10,303 +10,316 @@ import createTaskQueue from 'sync-task-queue'
|
|
10
10
|
|
11
11
|
import { saveAs } from 'file-saver';
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
export const version = "1.72"
|
13
|
+
const version = "1.73"
|
16
14
|
|
17
|
-
|
15
|
+
class File {
|
18
16
|
|
19
|
-
|
20
|
-
|
17
|
+
public static getFileMD5(file) {
|
18
|
+
return new Promise((resolve, reject) => {
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
20
|
+
const fileReader = new FileReader()
|
21
|
+
fileReader.readAsBinaryString(file);
|
22
|
+
fileReader.onload = e => {
|
23
|
+
const bmf = new BMF();
|
24
|
+
bmf.md5(file, (err, md5) => {
|
25
|
+
if (err !== null) {
|
26
|
+
resolve(err)
|
27
|
+
} else {
|
28
|
+
reject(md5)
|
29
|
+
}
|
30
|
+
}, progress => {
|
31
|
+
console.log('getFileMD5 progress number:', progress);
|
32
|
+
});
|
33
|
+
}
|
36
34
|
|
37
|
-
|
38
|
-
|
35
|
+
})
|
36
|
+
}
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
38
|
+
private static getBase64(blob) {
|
39
|
+
return new Promise((resolve, reject) => {
|
40
|
+
const reader = new FileReader();
|
41
|
+
reader.readAsDataURL(blob);
|
42
|
+
reader.onload = () => resolve(reader.result);
|
43
|
+
reader.onerror = error => reject(error);
|
44
|
+
});
|
45
|
+
}
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
}
|
61
|
-
} else {
|
62
|
-
fileChunks.push(file)
|
47
|
+
public static getFileChunks(file: any, chunkSize: number = 1024 * 1024 * 1): any {
|
48
|
+
|
49
|
+
let { size } = file
|
50
|
+
let totalChunks = Math.ceil(size / chunkSize)
|
51
|
+
let fileChunks = new Array<any>()
|
52
|
+
if (size > chunkSize) {
|
53
|
+
for (let i = 0; i < totalChunks; i++) {
|
54
|
+
let start = i * chunkSize
|
55
|
+
let end = (i + 1) * chunkSize
|
56
|
+
let chunk = file.slice(start, end)
|
57
|
+
fileChunks.push(chunk)
|
63
58
|
}
|
64
|
-
|
59
|
+
} else {
|
60
|
+
fileChunks.push(file)
|
65
61
|
}
|
62
|
+
return {
|
63
|
+
fileChunks: fileChunks,
|
64
|
+
sliceSize: chunkSize,
|
65
|
+
chunksLength: fileChunks.length
|
66
|
+
}
|
67
|
+
}
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
+
// 文件上传
|
70
|
+
public static async uploadFiles(files, chunkFileHandle, fileComplete = (file) => { }, completeHandle = (files) => { }, chunkSize: number = 1024 * 1024 * 1) {
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
if (files[0].fileName == "" || files[0].fileSize == "" || files[0].fileSize == 0) {
|
73
|
+
throw new Error("文件异常")
|
74
|
+
}
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
-
|
76
|
+
for (let i = 0; i < files.length; i++) {
|
77
|
+
const file = files[i];
|
78
|
+
const md5 = await File.getFileMD5(file)
|
77
79
|
|
78
|
-
|
80
|
+
let { fileChunks, sliceSize, chunksLength } = File.getFileChunks(file, chunkSize)
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
82
|
+
let directoryName = "";
|
83
|
+
if (files[i].webkitRelativePath != null && files[i].webkitRelativePath.trim() != "") {
|
84
|
+
let n = files[i].webkitRelativePath.lastIndexOf("\\")
|
85
|
+
if (n == -1)
|
86
|
+
n = files[i].webkitRelativePath.lastIndexOf("/")
|
87
|
+
if (n != -1)
|
88
|
+
directoryName = files[i].webkitRelativePath.substring(0, n)
|
89
|
+
}
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
}
|
107
|
-
await chunkFileHandle(chunkFile)
|
91
|
+
for (let index in fileChunks) {
|
92
|
+
let chunk = fileChunks[Number(index)]
|
93
|
+
const base64 = await File.getBase64(chunk) as string
|
94
|
+
let chunkFile = {
|
95
|
+
chunkIndex: Number(index), // 分片位置
|
96
|
+
chunksLength: chunksLength, // 分片长度
|
97
|
+
sliceSize: sliceSize, // 分片大小
|
98
|
+
chunkSize: chunk.size, // 当前分片实际大小
|
99
|
+
fileSize: file.size, // 文件总大小
|
100
|
+
fileName: file.name, // 文件名
|
101
|
+
lastModifiedDate: file.lastModifiedDate, // 最后修改时间
|
102
|
+
md5: md5,
|
103
|
+
index: i,
|
104
|
+
dataType: 'base64', // 数据的类型
|
105
|
+
directoryName: directoryName, // 数据的类型
|
106
|
+
total: files.length, // 总共文件数
|
107
|
+
data: base64.split(';base64,')[1], // 文件数据
|
108
108
|
}
|
109
|
-
|
109
|
+
await chunkFileHandle(chunkFile)
|
110
110
|
}
|
111
|
-
|
111
|
+
fileComplete(file);
|
112
112
|
}
|
113
|
+
completeHandle(files)
|
114
|
+
}
|
113
115
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
}
|
128
|
-
} catch (error) {
|
129
|
-
rej(error)
|
116
|
+
public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory = false): Promise<FileList | null> {
|
117
|
+
return new Promise((resolve: (value: FileList) => void, reject) => {
|
118
|
+
const el = document.createElement("input");
|
119
|
+
el.type = "file";
|
120
|
+
el.accept = options.accept;
|
121
|
+
el.webkitdirectory = isDirectory;
|
122
|
+
el.multiple = options.multiple;
|
123
|
+
el.addEventListener("change", (_) => {
|
124
|
+
try {
|
125
|
+
if (!el.files) {
|
126
|
+
reject(new Error("无法读取文件"));
|
127
|
+
} else {
|
128
|
+
resolve(el.files);
|
130
129
|
}
|
131
|
-
})
|
132
|
-
|
130
|
+
} catch (error) {
|
131
|
+
reject(error)
|
132
|
+
}
|
133
133
|
});
|
134
|
-
|
134
|
+
el.click();
|
135
|
+
});
|
136
|
+
}
|
135
137
|
|
136
|
-
|
138
|
+
public static readLocalExcel(onloadend: (file, workbook) => void, options: any = { multiple: true, accept: "*/*" }) {
|
137
139
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
}
|
140
|
+
this.selectFile(options).then((files: FileList | null) => {
|
141
|
+
if (files === null) {
|
142
|
+
return
|
143
|
+
}
|
144
|
+
for (let i = 0; i < files.length; i++) {
|
145
|
+
const file = files[i];
|
146
|
+
let reader = new FileReader();
|
147
|
+
reader.readAsArrayBuffer(file);
|
148
|
+
reader.onloadend = async function (e: any) {
|
149
|
+
let workbook = XLSX.read(e.target.result, { type: "binary" });
|
150
|
+
onloadend(file, workbook);
|
150
151
|
}
|
151
|
-
}
|
152
|
-
|
153
|
-
|
154
|
-
}
|
155
|
-
|
156
|
-
// type: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'
|
157
|
-
public static toExcel(data, type) {
|
158
|
-
let workbook = XLSX.read(data, { type: type });
|
159
|
-
return workbook;
|
160
|
-
}
|
152
|
+
}
|
153
|
+
}).catch(e => {
|
154
|
+
throw e;
|
155
|
+
})
|
156
|
+
}
|
161
157
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
// type: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'
|
159
|
+
public static toExcel(data, type) {
|
160
|
+
let workbook = XLSX.read(data, { type: type });
|
161
|
+
return workbook;
|
162
|
+
}
|
166
163
|
|
167
|
-
|
164
|
+
public static downloadExcel(workbook, name) {
|
168
165
|
|
169
|
-
|
170
|
-
|
171
|
-
var view = new Uint8Array(buf);
|
172
|
-
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
173
|
-
return buf;
|
174
|
-
}
|
166
|
+
/* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */
|
167
|
+
const wopts: any = { bookType: 'xls', bookSST: false, type: 'binary', cellStyles: true };
|
175
168
|
|
176
|
-
|
177
|
-
saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), name)
|
169
|
+
const wbout = XLSX.write(workbook, wopts);
|
178
170
|
|
171
|
+
function s2ab(s) {
|
172
|
+
const buf = new ArrayBuffer(s.length);
|
173
|
+
const view = new Uint8Array(buf);
|
174
|
+
for (let i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
175
|
+
return buf;
|
179
176
|
}
|
180
177
|
|
178
|
+
/* the saveAs call downloads a file on the local machine */
|
179
|
+
saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), name)
|
180
|
+
|
181
181
|
}
|
182
182
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
} else if (docElm.mozRequestFullScreen) {
|
190
|
-
docElm.mozRequestFullScreen();
|
191
|
-
} else if (docElm.msRequestFullscreen) {
|
192
|
-
docElm.msRequestFullscreen();
|
193
|
-
} else if (docElm.oRequestFullscreen) {
|
194
|
-
docElm.oRequestFullscreen();
|
195
|
-
} else if (docElm.webkitRequestFullScreen) {
|
196
|
-
docElm.webkitRequestFullScreen();
|
197
|
-
}
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
const fullScreen = (docElm: any = null) => {
|
187
|
+
if (docElm === null) {
|
188
|
+
docElm = document.documentElement
|
198
189
|
}
|
190
|
+
if (docElm.requestFullscreen) {
|
191
|
+
docElm.requestFullscreen();
|
192
|
+
} else if (docElm.mozRequestFullScreen) {
|
193
|
+
docElm.mozRequestFullScreen();
|
194
|
+
} else if (docElm.msRequestFullscreen) {
|
195
|
+
docElm.msRequestFullscreen();
|
196
|
+
} else if (docElm.oRequestFullscreen) {
|
197
|
+
docElm.oRequestFullscreen();
|
198
|
+
} else if (docElm.webkitRequestFullScreen) {
|
199
|
+
docElm.webkitRequestFullScreen();
|
200
|
+
}
|
201
|
+
}
|
199
202
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
203
|
+
// 获取最大公约数
|
204
|
+
function getGcd(a, b) {
|
205
|
+
let n1, n2;
|
206
|
+
if (a > b) {
|
207
|
+
n1 = a;
|
208
|
+
n2 = b;
|
209
|
+
} else {
|
210
|
+
n1 = b;
|
211
|
+
n2 = a;
|
212
|
+
}
|
210
213
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
}
|
214
|
+
let remainder = n1 % n2;
|
215
|
+
if (remainder === 0) {
|
216
|
+
return n2;
|
217
|
+
} else {
|
218
|
+
return getGcd(n2, remainder)
|
217
219
|
}
|
220
|
+
}
|
218
221
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
222
|
+
const getVideoScale = async (url: string) => {
|
223
|
+
const video = document.createElement('video');
|
224
|
+
video.setAttribute("width", "10");
|
225
|
+
video.setAttribute("height", "10");
|
226
|
+
video.setAttribute("style", "position: absolute;opacity: 0;z-index: -5;top: 0;");
|
227
|
+
video.setAttribute("src", url);
|
225
228
|
|
226
|
-
|
229
|
+
document.body.appendChild(video);
|
227
230
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
})
|
231
|
+
const p = new Promise(function (resolve, reject) {
|
232
|
+
video.addEventListener('canplay', function (e: any) {
|
233
|
+
const gcd = getGcd(e.target.videoWidth, e.target.videoHeight);
|
234
|
+
resolve([e.target.videoWidth / gcd, e.target.videoHeight / gcd])
|
233
235
|
})
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
236
|
+
})
|
237
|
+
const res = await p;
|
238
|
+
document.body.removeChild(video);
|
239
|
+
return res
|
240
|
+
}
|
241
|
+
|
242
|
+
// 读取video中某一帧转为图片base64
|
243
|
+
const getVideoBase64 = async (url: string, timestamp = -1, bufftime = 2000) => {
|
244
|
+
|
245
|
+
const scale = await getVideoScale(url) as any;
|
246
|
+
const width = scale[0] + ''
|
247
|
+
const height = scale[1] + ''
|
248
|
+
const base64 = await new Promise(function (resolve) {
|
249
|
+
let dataURL = ''
|
250
|
+
let video = document.createElement('video')
|
251
|
+
video.setAttribute('crossOrigin', 'anonymous') //处理跨域
|
252
|
+
video.setAttribute('src', url)
|
253
|
+
video.setAttribute('width', width)
|
254
|
+
video.setAttribute('height', height)
|
255
|
+
video.setAttribute('autoplay', 'autoplay')
|
256
|
+
document.body.appendChild(video)
|
257
|
+
video.addEventListener('loadeddata', function () {
|
258
|
+
|
259
|
+
video.pause()
|
260
|
+
|
261
|
+
if (timestamp === -1) {
|
262
|
+
timestamp = Math.random() * video.duration
|
263
|
+
}
|
264
|
+
video.currentTime = timestamp
|
265
|
+
|
266
|
+
/*
|
267
|
+
使用定时器为了视频跳转到某一帧的时候视频进行缓冲,等视频加载完成之后进行截图
|
268
|
+
如果截图是黑屏说明视频未加载完成就开始截屏了
|
269
|
+
*/
|
270
|
+
setTimeout(() => {
|
271
|
+
let canvas = document.createElement('canvas');
|
272
|
+
// const width = canvas.width; //canvas的尺寸和图片一样
|
273
|
+
// const height = canvas.height;
|
274
|
+
canvas.width = video.width
|
275
|
+
canvas.height = video.height
|
276
|
+
canvas.getContext('2d')!.drawImage(video, 0, 0, video.width, video.height) //绘制canvas
|
277
|
+
dataURL = canvas.toDataURL('image/jpeg') //转换为base64
|
278
|
+
document.body.removeChild(video)
|
279
|
+
resolve(dataURL)
|
280
|
+
}, bufftime);
|
238
281
|
|
239
|
-
// 读取video中某一帧转为图片base64
|
240
|
-
export const getVideoBase64 = async (url: string, timestamp: number = -1, bufftime: number = 2000) => {
|
241
|
-
|
242
|
-
const scale = await getVideoScale(url) as any;
|
243
|
-
const width = scale[0] + ''
|
244
|
-
const height = scale[1] + ''
|
245
|
-
const base64 = await new Promise(function (resolve) {
|
246
|
-
let dataURL = ''
|
247
|
-
let video = document.createElement('video')
|
248
|
-
video.setAttribute('crossOrigin', 'anonymous') //处理跨域
|
249
|
-
video.setAttribute('src', url)
|
250
|
-
video.setAttribute('width', width)
|
251
|
-
video.setAttribute('height', height)
|
252
|
-
video.setAttribute('autoplay', 'autoplay')
|
253
|
-
document.body.appendChild(video)
|
254
|
-
video.addEventListener('loadeddata', function () {
|
255
|
-
|
256
|
-
video.pause()
|
257
|
-
|
258
|
-
if (timestamp === -1) {
|
259
|
-
timestamp = Math.random() * video.duration
|
260
|
-
}
|
261
|
-
video.currentTime = timestamp
|
262
|
-
|
263
|
-
/*
|
264
|
-
使用定时器为了视频跳转到某一帧的时候视频进行缓冲,等视频加载完成之后进行截图
|
265
|
-
如果截图是黑屏说明视频未加载完成就开始截屏了
|
266
|
-
*/
|
267
|
-
setTimeout(() => {
|
268
|
-
let canvas = document.createElement('canvas');
|
269
|
-
// const width = canvas.width; //canvas的尺寸和图片一样
|
270
|
-
// const height = canvas.height;
|
271
|
-
canvas.width = video.width
|
272
|
-
canvas.height = video.height
|
273
|
-
canvas.getContext('2d')!.drawImage(video, 0, 0, video.width, video.height) //绘制canvas
|
274
|
-
dataURL = canvas.toDataURL('image/jpeg') //转换为base64
|
275
|
-
document.body.removeChild(video)
|
276
|
-
resolve(dataURL)
|
277
|
-
}, bufftime);
|
278
|
-
|
279
|
-
})
|
280
282
|
})
|
283
|
+
})
|
281
284
|
|
282
|
-
|
283
|
-
|
285
|
+
return base64;
|
286
|
+
}
|
284
287
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
288
|
+
function getType(values) {
|
289
|
+
return Object
|
290
|
+
.prototype
|
291
|
+
.toString
|
292
|
+
.call(values)
|
293
|
+
.replace(/\[(\S+) (\S+)\]/, '$2')
|
294
|
+
}
|
292
295
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
296
|
+
const extensionToLowerCase = (fileName: string) => {
|
297
|
+
const n = fileName.lastIndexOf(".");
|
298
|
+
const extension = fileName.substring(n).toLowerCase();
|
299
|
+
return fileName.substring(0, n) + extension;
|
300
|
+
}
|
298
301
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
}
|
302
|
+
const isURL = (strUrl) => {
|
303
|
+
const regular = /^\b(((https?|ftp):\/\/)?[-a-z0-9]+(\.[-a-z0-9]+)*\.(?:com|edu|gov|int|mil|net|org|biz|info|name|museum|asia|coop|aero|[a-z][a-z]|((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]\d)|\d))\b(\/[-a-z0-9_:\\@&?=+,.!\\/~%\\$]*)?)$/i;
|
304
|
+
if (regular.test(strUrl.trim())) {
|
305
|
+
return true;
|
306
|
+
} else {
|
307
|
+
return false;
|
306
308
|
}
|
309
|
+
}
|
310
|
+
|
307
311
|
|
308
|
-
|
312
|
+
export const EMacro = {
|
309
313
|
|
314
|
+
version,
|
315
|
+
File,
|
316
|
+
fullScreen,
|
317
|
+
getGcd,
|
318
|
+
getVideoScale,
|
319
|
+
getVideoBase64,
|
320
|
+
getType,
|
321
|
+
extensionToLowerCase,
|
322
|
+
isURL
|
310
323
|
}
|
311
324
|
|
312
325
|
|