efront 3.20.13 → 3.20.16
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/coms/kugou/player.js +9 -11
- package/coms/kugou/player.less +2 -2
- package/coms/layer/glance.js +1 -1
- package/coms/zimoli/AudioContext_test.js +1 -1
- package/coms/zimoli/HexEditor.less +5 -2
- package/coms/zimoli/audio.js +64 -82
- package/coms/zimoli/audio_test.html +1 -1
- package/coms/zimoli/audio_test.js +1 -3
- package/coms/zimoli/lattice.js +16 -18
- package/coms/zimoli/lattice_test.js +1 -1
- package/coms/zimoli/model.less +3 -0
- package/coms/zimoli/picture.js +1 -1
- package/coms/zimoli/selectList_test.html +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/kugou/player.js
CHANGED
|
@@ -101,6 +101,7 @@ var $scope = {
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
process(currentTime, duration) {
|
|
104
|
+
render.refresh();
|
|
104
105
|
if (currentTime === duration) {
|
|
105
106
|
$scope.pause();
|
|
106
107
|
return false;
|
|
@@ -118,7 +119,6 @@ var $scope = {
|
|
|
118
119
|
$scope.currentTheta = ((currentTime * 6 + 90) % 180 - 90) / 180 * Math.PI;
|
|
119
120
|
playState.width = (currentTime * 100 / duration).toFixed(2) + `%`;
|
|
120
121
|
$scope.currentProcess = `width:` + playState.width;
|
|
121
|
-
render.refresh();
|
|
122
122
|
},
|
|
123
123
|
effectPage(effect = !$scope.effect) {
|
|
124
124
|
$scope.effect = effect;
|
|
@@ -180,6 +180,7 @@ var $scope = {
|
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
play(hash = musicList.active_hash) {
|
|
183
|
+
render.refresh();
|
|
183
184
|
var isPlayback = typeof hash === "number";
|
|
184
185
|
if (isPlayback) {
|
|
185
186
|
if (hash < 0) {
|
|
@@ -233,7 +234,6 @@ var $scope = {
|
|
|
233
234
|
return alert("暂不支持在您的浏览器中播放!");
|
|
234
235
|
}
|
|
235
236
|
musicList.active_hash = hash;
|
|
236
|
-
render.refresh();
|
|
237
237
|
$scope.playing = true;
|
|
238
238
|
playState.width = 0;
|
|
239
239
|
getMusicInfo(hash).loading_promise.then((response) => {
|
|
@@ -296,15 +296,13 @@ var createControls = function () {
|
|
|
296
296
|
var player = document.createElement("music-player");
|
|
297
297
|
player.setAttribute("ng-class", "{play:playing===true,pause:playing===false,page:page,effect:effect}");
|
|
298
298
|
player.innerHTML = Player;
|
|
299
|
-
var [
|
|
300
|
-
bindtouch(player, function (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
return { x: progress.offsetWidth };
|
|
299
|
+
var [, progress] = player.children;
|
|
300
|
+
bindtouch(player, function (_, event) {
|
|
301
|
+
touching = true;
|
|
302
|
+
var x = event.clientX - getScreenPosition(player).left;
|
|
303
|
+
let _audio = $scope.audio
|
|
304
|
+
css(progress, { width: x });
|
|
305
|
+
$scope.process(x / player.offsetWidth * _audio.duration, _audio.duration);
|
|
308
306
|
}, "x");
|
|
309
307
|
bindtouch(player, function (value) {
|
|
310
308
|
var top = getScreenPosition(player).top;
|
package/coms/kugou/player.less
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
>.info {
|
|
188
188
|
width: 100%;
|
|
189
189
|
margin-right: -200px;
|
|
190
|
-
line-height:
|
|
190
|
+
line-height: 1;
|
|
191
191
|
text-align: left;
|
|
192
192
|
padding: 46px 5px 0 5px;
|
|
193
193
|
z-index: 2;
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
|
|
261
261
|
&.page>.krc {
|
|
262
262
|
text-align: center;
|
|
263
|
-
line-height:
|
|
263
|
+
line-height: 2.2;
|
|
264
264
|
margin-bottom: -80px;
|
|
265
265
|
bottom: 50%;
|
|
266
266
|
height: 180px;
|
package/coms/layer/glance.js
CHANGED
|
@@ -13,7 +13,7 @@ var dragview = function (dragview) {
|
|
|
13
13
|
moving = false;
|
|
14
14
|
} else {
|
|
15
15
|
var { childNodes } = target;
|
|
16
|
-
if (getComputedStyle(target).cursor === 'auto') for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
|
|
16
|
+
if (getComputedStyle(target).cursor === 'auto' && getComputedStyle(target).userSelect !== 'none') for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
|
|
17
17
|
var child = childNodes[cx];
|
|
18
18
|
if (child.nodeType === 3) {
|
|
19
19
|
moving = false;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
*{
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
1
4
|
& {
|
|
2
5
|
background: #fff;
|
|
3
6
|
display: inline-block;
|
|
4
7
|
resize: both;
|
|
5
|
-
font-
|
|
8
|
+
font-size: 16px;
|
|
6
9
|
position: relative;
|
|
7
10
|
min-height: 100px;
|
|
8
11
|
padding: 0 0 10px 16px;
|
|
9
12
|
font-family: 宋体;
|
|
10
|
-
width:
|
|
13
|
+
width: 422px;
|
|
11
14
|
|
|
12
15
|
>a {
|
|
13
16
|
display: inline-block;
|
package/coms/zimoli/audio.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var alertError = alert.bind(null, 'error');
|
|
2
|
-
var Context = window.webkitAudioContext || window.AudioContext;
|
|
3
|
-
var globalContext = Context && new Context;
|
|
4
2
|
|
|
5
3
|
var reportError = function (error) {
|
|
6
4
|
switch (error.code || error.name) {
|
|
@@ -25,85 +23,68 @@ var reportError = function (error) {
|
|
|
25
23
|
|
|
26
24
|
function init() {
|
|
27
25
|
if (!this.audioPromise) {
|
|
28
|
-
this.audioPromise =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}).then((stream) => {
|
|
33
|
-
var context = new Context;
|
|
26
|
+
this.audioPromise = navigator.mediaDevices.getUserMedia({
|
|
27
|
+
audio: { deviceId: this.deviceId }
|
|
28
|
+
}).then(async (stream) => {
|
|
29
|
+
var context = new AudioContext;
|
|
34
30
|
this.gain = context.createGain();
|
|
31
|
+
var analyser = context.createAnalyser();
|
|
32
|
+
analyser.fftSize = 2048;
|
|
35
33
|
context.resume();
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
var createScript = context.createScriptProcessor || context.createJavaScriptNode;
|
|
39
|
-
var recorder = createScript.apply(context, [0, 1, 1]);
|
|
40
|
-
return [recorder, audioInput, context];
|
|
34
|
+
var source = context.createMediaStreamSource(stream);
|
|
35
|
+
return [source, context, analyser];
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
38
|
return this.audioPromise;
|
|
44
39
|
}
|
|
45
|
-
|
|
40
|
+
|
|
41
|
+
async function stop() {
|
|
46
42
|
var commandCount = ++this.commandCount;
|
|
47
43
|
if (!this.running) return;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
var [source, context, analyser] = await this.init();
|
|
45
|
+
cancelAnimationFrame(analyser.frame);
|
|
46
|
+
if (this.commandCount !== commandCount) return;
|
|
47
|
+
this.running = false;
|
|
48
|
+
source.disconnect(analyser);
|
|
49
|
+
if (this.gain) {
|
|
50
|
+
source.disconnect(this.gain);
|
|
51
|
+
this.gain.disconnect(context.destination);
|
|
52
|
+
} else {
|
|
53
|
+
source.disconnect(context.destination);
|
|
54
|
+
}
|
|
55
|
+
this.context = null;
|
|
56
|
+
this.audioPromise = null;
|
|
57
|
+
this.gain = null;
|
|
58
|
+
context.suspend();
|
|
59
|
+
await context.close();
|
|
60
|
+
if (this.audio) this.audio.pause();
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
|
|
63
|
+
async function start() {
|
|
64
64
|
if (this.running) return;
|
|
65
65
|
var commandCount = ++this.commandCount;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var buffer = copyData(e);
|
|
71
|
-
cast(this, buffer);
|
|
72
|
-
this.onprocess instanceof Function && this.onprocess(buffer);
|
|
73
|
-
};
|
|
74
|
-
this.running = true;
|
|
75
|
-
audioInput.connect(recorder);
|
|
76
|
-
recorder.connect(this.gain).connect(context.destination);
|
|
77
|
-
if (this.audio) this.audio.play();
|
|
78
|
-
}).catch(reportError);
|
|
79
|
-
}
|
|
80
|
-
function copyData(audioProcessingEvent) {
|
|
81
|
-
// The input buffer is the song we loaded earlier
|
|
82
|
-
var inputBuffer = audioProcessingEvent.inputBuffer;
|
|
83
|
-
|
|
84
|
-
// The output buffer contains the samples that will be modified and played
|
|
85
|
-
var outputBuffer = audioProcessingEvent.outputBuffer;
|
|
86
|
-
var distBuffer = [];
|
|
87
|
-
// Loop through the output channels (in this case there is only one)
|
|
88
|
-
var { numberOfChannels } = inputBuffer;
|
|
89
|
-
for (var channel = 0; channel < numberOfChannels; channel++) {
|
|
90
|
-
var inputData = inputBuffer.getChannelData(channel);
|
|
91
|
-
var outputData = outputBuffer.getChannelData(channel);
|
|
92
|
-
|
|
93
|
-
// Loop through the 4096 samples
|
|
94
|
-
for (var cx = 0, dx = inputData.length; cx < dx; cx++) {
|
|
95
|
-
// make output equal to the same as the input
|
|
96
|
-
outputData[cx] = inputData[cx];
|
|
97
|
-
if (!distBuffer[cx]) distBuffer[cx] = inputData[cx];
|
|
98
|
-
else distBuffer[cx] += inputData[cx];
|
|
99
|
-
|
|
100
|
-
// add noise to each output sample
|
|
101
|
-
// outputData[cx] += ((Math.random() * 2) - 1) * 0.2;
|
|
102
|
-
|
|
103
|
-
}
|
|
66
|
+
try {
|
|
67
|
+
var [source, context, analyser] = await this.init();
|
|
68
|
+
} catch (e) {
|
|
69
|
+
reportError(e);
|
|
104
70
|
}
|
|
105
|
-
|
|
71
|
+
if (commandCount !== this.commandCount) return;
|
|
72
|
+
this.context = context;
|
|
73
|
+
var dancingArray = new Uint8Array(analyser.fftSize);
|
|
74
|
+
var animate = () => {
|
|
75
|
+
analyser.getByteTimeDomainData(dancingArray);
|
|
76
|
+
cast(this, dancingArray);
|
|
77
|
+
analyser.frame = requestAnimationFrame(animate);
|
|
78
|
+
this.onprocess instanceof Function && this.onprocess(dancingArray);
|
|
79
|
+
};
|
|
80
|
+
animate();
|
|
81
|
+
this.running = true;
|
|
82
|
+
|
|
83
|
+
source.connect(analyser);
|
|
84
|
+
source.connect(this.gain).connect(context.destination);
|
|
85
|
+
if (this.audio) this.audio.play();
|
|
106
86
|
}
|
|
87
|
+
|
|
107
88
|
class Source {
|
|
108
89
|
running = false;
|
|
109
90
|
audioPromise;
|
|
@@ -119,7 +100,7 @@ class Source {
|
|
|
119
100
|
}
|
|
120
101
|
init() {
|
|
121
102
|
if (this.audioPromise) return this.audioPromise;
|
|
122
|
-
var context = new
|
|
103
|
+
var context = new AudioContext;
|
|
123
104
|
var audio = document.createElement("audio");
|
|
124
105
|
this.gain = context.createGain();
|
|
125
106
|
console.log(this.gain);
|
|
@@ -131,9 +112,10 @@ class Source {
|
|
|
131
112
|
|
|
132
113
|
return this.audioPromise = Promise.resolve([recorder, source, context]);
|
|
133
114
|
}
|
|
134
|
-
start = start;
|
|
135
|
-
stop = stop;
|
|
136
115
|
}
|
|
116
|
+
Source.prototype.start = start;
|
|
117
|
+
Source.prototype.stop = stop;
|
|
118
|
+
|
|
137
119
|
class Recorder {
|
|
138
120
|
running = false;
|
|
139
121
|
hasMicrophone = navigator.getUserMedia instanceof Function;
|
|
@@ -141,6 +123,8 @@ class Recorder {
|
|
|
141
123
|
commandCount = 0;
|
|
142
124
|
onprocess;
|
|
143
125
|
context;
|
|
126
|
+
workletUrl;
|
|
127
|
+
workletName;
|
|
144
128
|
constructor(device) {
|
|
145
129
|
if (!device) device = {};
|
|
146
130
|
var config = {
|
|
@@ -154,10 +138,11 @@ class Recorder {
|
|
|
154
138
|
|
|
155
139
|
extend(this, config);
|
|
156
140
|
}
|
|
157
|
-
init = init;
|
|
158
|
-
start = start;
|
|
159
|
-
stop = stop;
|
|
160
141
|
}
|
|
142
|
+
Recorder.prototype.init = init;
|
|
143
|
+
Recorder.prototype.start = start;
|
|
144
|
+
Recorder.prototype.stop = stop;
|
|
145
|
+
|
|
161
146
|
class Monitor {
|
|
162
147
|
running = false;
|
|
163
148
|
context;
|
|
@@ -171,19 +156,16 @@ class Monitor {
|
|
|
171
156
|
extend(this, config);
|
|
172
157
|
|
|
173
158
|
}
|
|
174
|
-
init = init;
|
|
175
|
-
start = start;
|
|
176
|
-
stop = stop;
|
|
177
159
|
}
|
|
160
|
+
Monitor.prototype.init = init;
|
|
161
|
+
Monitor.prototype.start = start;
|
|
162
|
+
Monitor.prototype.stop = stop;
|
|
163
|
+
|
|
178
164
|
var audio = {
|
|
179
165
|
Recorder,
|
|
180
166
|
Monitor,
|
|
181
167
|
Source,
|
|
182
|
-
Context,
|
|
183
|
-
copyData,
|
|
184
|
-
getGlobalContext() {
|
|
185
|
-
return globalContext;
|
|
186
|
-
},
|
|
168
|
+
Context: AudioContext,
|
|
187
169
|
getRecorder() {
|
|
188
170
|
return new Recorder
|
|
189
171
|
},
|
|
@@ -13,10 +13,8 @@ function main() {
|
|
|
13
13
|
context.beginPath();
|
|
14
14
|
context.moveTo(0, canvas.offsetHeight / 2);
|
|
15
15
|
var max = 2;
|
|
16
|
-
// [].forEach.call(buffer, function (db, cx) {
|
|
17
|
-
// if (db > max) max = db;
|
|
18
|
-
// });
|
|
19
16
|
[].forEach.call(buffer, function (db, cx) {
|
|
17
|
+
db = (db - 128) / 128;
|
|
20
18
|
context.lineTo(cx * canvas.width / buffer.length, canvas.height / 2 - db / max * canvas.height);
|
|
21
19
|
});
|
|
22
20
|
context.stroke();
|
package/coms/zimoli/lattice.js
CHANGED
|
@@ -7,6 +7,7 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
7
7
|
if (!_layers.length) return;
|
|
8
8
|
var clientWidth = parseFloat(freePixel(_box.clientWidth));
|
|
9
9
|
if (!clientWidth) return;
|
|
10
|
+
var savedCount = boxCount;
|
|
10
11
|
boxCount = clientWidth / minWidth | 0;
|
|
11
12
|
if (boxCount >= _layers.length) {
|
|
12
13
|
boxCount = _layers.length;
|
|
@@ -21,6 +22,12 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
21
22
|
else removeClass(_box, inadequate_class);
|
|
22
23
|
_box.paddingMax = boxCount;
|
|
23
24
|
_box.group = boxCount;
|
|
25
|
+
if (savedCount === boxCount) return;
|
|
26
|
+
_box.clean();
|
|
27
|
+
[].forEach.call(_box.children, function (c) {
|
|
28
|
+
build(c);
|
|
29
|
+
});
|
|
30
|
+
return true;
|
|
24
31
|
};
|
|
25
32
|
if (layers) {
|
|
26
33
|
var _box = list(element, function (index) {
|
|
@@ -54,28 +61,19 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
54
61
|
else if (isElement(element.with)) build(element.with);
|
|
55
62
|
};
|
|
56
63
|
var go = _box.go;
|
|
57
|
-
_box.go = function (
|
|
64
|
+
_box.go = function () {
|
|
58
65
|
resize();
|
|
59
|
-
|
|
60
|
-
go.call(_box, value);
|
|
61
|
-
};
|
|
62
|
-
var _onappend = function () {
|
|
63
|
-
_box.resize();
|
|
66
|
+
go.apply(this, arguments);
|
|
64
67
|
};
|
|
65
|
-
onappend(_box, _onappend);
|
|
66
68
|
_box.resize = lazy(function () {
|
|
67
|
-
var savedCount = boxCount;
|
|
68
69
|
var index = _box.index();
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
go.call(_box, index);
|
|
78
|
-
}, 0);
|
|
70
|
+
var savedCount = boxCount;
|
|
71
|
+
if (resize()) {
|
|
72
|
+
var realIndex = index * (savedCount || 1);
|
|
73
|
+
index = realIndex / boxCount || 0;
|
|
74
|
+
go.call(_box, index);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
79
77
|
resizingList.set(_box);
|
|
80
78
|
on('resize')(_box, _box.resize);
|
|
81
79
|
return _box;
|
package/coms/zimoli/model.less
CHANGED
package/coms/zimoli/picture.js
CHANGED
|
@@ -38,7 +38,7 @@ var create = function (url, key) {
|
|
|
38
38
|
image.shape = function (x, y, scaled, rotate) {
|
|
39
39
|
var style = get_style(x, y, scaled, rotate);
|
|
40
40
|
css(imgpic, style);
|
|
41
|
-
if (imgpic) dispatch(
|
|
41
|
+
if (imgpic) dispatch(p, 'scaled');
|
|
42
42
|
};
|
|
43
43
|
image.close = function () {
|
|
44
44
|
if (!p.touchclose) return false;
|