efront 4.35.5 → 4.35.6
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/apps/_index.html +41 -41
- package/apps/blank/index.html +20 -20
- package/apps/noice/index.html +42 -42
- package/apps/pay/paypal.jsp +0 -0
- package/apps/pay/wxpay.jsp +32 -0
- package/apps/pivot/dht/rent.html +14 -0
- package/apps/pivot/dht/rent.js +148 -0
- package/apps/pivot/dht/rent.less +46 -0
- package/apps/pivot/home/desktop.xht +0 -0
- package/apps/pivot/menu.yml +6 -1
- package/apps/pivot/shop/goods/list.xht +183 -0
- package/apps/pivot/shop/home.xht +20 -0
- package/apps/pivot/shop/mind/list.xht +1 -0
- package/apps/pivot/shop/order/create.xht +49 -0
- package/apps/pivot/shop/order/list.xht +1 -0
- package/apps/pivot/shop/paypal.jsp +23 -0
- package/apps/pivot/soft/list.html +0 -0
- package/apps/pivot/soft/list.js +9 -0
- package/apps/pivot/soft/list.less +0 -0
- package/apps/pivot//344/270/273/351/241/265.html +42 -42
- package/coms/7z_temp/Java.js +93 -0
- package/coms/7z_temp/LzmaBench.java +392 -0
- package/coms/7z_temp/read-from-java-code.js +28 -0
- package/coms/7z_temp//350/257/264/346/230/216.md +1 -0
- package/coms/basic/JSAM.js +259 -259
- package/coms/basic/JSAM_test.js +3 -5
- package/coms/basic/check.js +42 -42
- package/coms/basic/color.js +696 -696
- package/coms/basic/crc.js +39 -39
- package/coms/basic/getIndexFromOrderedArray.js +39 -39
- package/coms/basic/isObject.js +3 -3
- package/coms/basic/keys.js +4 -4
- package/coms/basic/lazy.js +78 -78
- package/coms/basic/refilm.js +96 -96
- package/coms/basic/saveToOrderedArray.js +11 -11
- package/coms/basic/strings.js +0 -1
- package/coms/basic_/&pget.js +1 -0
- package/coms/basic_/&pset.js +1 -0
- package/coms/basic_/Proxy.js +6 -0
- package/coms/basic_/Reflect.js +55 -0
- package/coms/compile/autoeval.js +24 -5
- package/coms/compile/autoeval_test.js +5 -1
- package/coms/compile/bracket.js +51 -0
- package/coms/compile/bracket_test.js +9 -0
- package/coms/compile/createvm.js +35 -0
- package/coms/compile/createvm_test.js +7 -0
- package/coms/compile/scanner.js +653 -653
- package/coms/compile/scanner2.js +23 -0
- package/coms/docs/getMimeData_test.js +19 -19
- package/coms/docs/md5.js +173 -173
- package/coms/frame/top.less +190 -190
- package/coms/pivot/DB.js +9 -0
- package/coms/pivot/paypal-var.js +1 -0
- package/coms/pivot//345/225/206/345/223/201.js +1 -0
- package/coms/zimoli/AudioContext_test.html +5 -5
- package/coms/zimoli/AudioContext_test.js +92 -92
- package/coms/zimoli/AudioContext_test.less +114 -114
- package/coms/zimoli/alert_test.js +11 -11
- package/coms/zimoli/dispatch.js +50 -50
- package/coms/zimoli/extendTouchEvent.js +8 -8
- package/coms/zimoli/fullscreen.js +52 -52
- package/coms/zimoli/gallery.less +13 -13
- package/coms/zimoli/gallery_test.html +2 -2
- package/coms/zimoli/gallery_test.js +14 -14
- package/coms/zimoli/gallery_test.less +17 -17
- package/coms/zimoli/getChanged.js +7 -7
- package/coms/zimoli/getChanges.js +13 -13
- package/coms/zimoli/lattice.js +109 -109
- package/coms/zimoli/lattice_test.less +23 -23
- package/coms/zimoli/picture.less +71 -71
- package/coms/zimoli/refilm_test.html +41 -41
- package/coms/zimoli/refilm_test.less +102 -102
- package/coms/zimoli/xml.js +131 -131
- package/data/keystore/cross-cert.pem +21 -21
- package/data/keystore/cross-key.pem +27 -27
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/public//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +2 -2
- /package/apps/pivot/{tick → ticket}/list.js +0 -0
package/coms/frame/top.less
CHANGED
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
& {
|
|
2
|
-
// background-color : #fff;
|
|
3
|
-
user-select: none;
|
|
4
|
-
position: relative;
|
|
5
|
-
z-index: 1;
|
|
6
|
-
padding: 4px 0;
|
|
7
|
-
line-height: 0;
|
|
8
|
-
-webkit-backdrop-filter: saturate(180%) blur(20px);
|
|
9
|
-
backdrop-filter: saturate(180%) blur(20px);
|
|
10
|
-
background: rgba(255, 255, 255, .7);
|
|
11
|
-
box-shadow: 0 0 6px -4px rgba(0, 0, 0, .3);
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
white-space: nowrap;
|
|
14
|
-
|
|
15
|
-
>div {
|
|
16
|
-
display: inline-block;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[insert] {
|
|
21
|
-
display: inline-block;
|
|
22
|
-
position: sticky;
|
|
23
|
-
right: 0;
|
|
24
|
-
width: auto;
|
|
25
|
-
background: #fff;
|
|
26
|
-
background: linear-gradient(90deg, #fff0, #fff 10px);
|
|
27
|
-
background-clip: border-box;
|
|
28
|
-
z-index: 1;
|
|
29
|
-
right: 0;
|
|
30
|
-
padding-left: 10px;
|
|
31
|
-
margin-left: -10px;
|
|
32
|
-
box-sizing: border-box;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.searchbox {
|
|
36
|
-
margin: 8px 10px;
|
|
37
|
-
vertical-align: middle;
|
|
38
|
-
max-width: 100%;
|
|
39
|
-
float: right;
|
|
40
|
-
background-color: #f6f6f6;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
>.menu-items {
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
padding-left: 12px;
|
|
46
|
-
max-width: 100%;
|
|
47
|
-
box-sizing: border-box;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.menu-item {
|
|
51
|
-
&:last-child {
|
|
52
|
-
margin-right: 12px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&.menu-switch {
|
|
56
|
-
background-color: #F2B33F;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.menu-page {
|
|
60
|
-
background-color: #ccc;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.actived {
|
|
64
|
-
background-color: #5ad;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
border-radius : 18px;
|
|
68
|
-
background-color: #629aa9;
|
|
69
|
-
color : #fff;
|
|
70
|
-
position : relative;
|
|
71
|
-
display : inline-block;
|
|
72
|
-
width : 36px;
|
|
73
|
-
height : 36px;
|
|
74
|
-
line-height : 37px;
|
|
75
|
-
text-align : center;
|
|
76
|
-
margin-right : 10px;
|
|
77
|
-
overflow : visible;
|
|
78
|
-
|
|
79
|
-
>close {
|
|
80
|
-
position: absolute;
|
|
81
|
-
right: -12px;
|
|
82
|
-
top: -12px;
|
|
83
|
-
width: 24px;
|
|
84
|
-
height: 24px;
|
|
85
|
-
line-height: 24px;
|
|
86
|
-
text-align: center;
|
|
87
|
-
color: #666;
|
|
88
|
-
z-index: 2;
|
|
89
|
-
|
|
90
|
-
&:hover {
|
|
91
|
-
color: #f24;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
>span {
|
|
96
|
-
width: auto;
|
|
97
|
-
min-width: 20px;
|
|
98
|
-
height: 20px;
|
|
99
|
-
line-height: 20px;
|
|
100
|
-
text-align: center;
|
|
101
|
-
border-radius: 10px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// &:nth-child(2)>span {
|
|
105
|
-
// background-color: @primary-dot-color;
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
// &:nth-child(3)>span {
|
|
109
|
-
// background-color: @extra-dot-color1;
|
|
110
|
-
// }
|
|
111
|
-
|
|
112
|
-
// &:nth-child(4)>span {
|
|
113
|
-
// background-color: @extra-dot-color2;
|
|
114
|
-
// }
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.option-items {
|
|
118
|
-
|
|
119
|
-
>* {
|
|
120
|
-
height: 60px;
|
|
121
|
-
line-height: 60px;
|
|
122
|
-
padding: 0 16px;
|
|
123
|
-
vertical-align: top;
|
|
124
|
-
// background : transparent;
|
|
125
|
-
// color : black;
|
|
126
|
-
margin-left: 10px;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.user-name {
|
|
131
|
-
height: 60px;
|
|
132
|
-
text-align: left;
|
|
133
|
-
|
|
134
|
-
p {
|
|
135
|
-
line-height: 14px;
|
|
136
|
-
margin: 10px 0;
|
|
137
|
-
font-size: 14px;
|
|
138
|
-
color: #F2B33F;
|
|
139
|
-
font-weight: 700;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
span {
|
|
143
|
-
font-size: 12px;
|
|
144
|
-
line-height: 12px;
|
|
145
|
-
color: #424f63;
|
|
146
|
-
font-weight: normal;
|
|
147
|
-
vertical-align: top;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.userinfo {
|
|
152
|
-
height: 59px;
|
|
153
|
-
vertical-align: top;
|
|
154
|
-
background: transparent;
|
|
155
|
-
color: #ccc;
|
|
156
|
-
box-shadow: none;
|
|
157
|
-
|
|
158
|
-
>* {
|
|
159
|
-
display: inline-block;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
img {
|
|
163
|
-
vertical-align: top;
|
|
164
|
-
border-radius: 50%;
|
|
165
|
-
height: 50px;
|
|
166
|
-
width: 50px;
|
|
167
|
-
margin: 5px;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
btn {
|
|
172
|
-
vertical-align: top;
|
|
173
|
-
}
|
|
174
|
-
@keyframes rotate {
|
|
175
|
-
0%{
|
|
176
|
-
transform: rotate(0deg);
|
|
177
|
-
}
|
|
178
|
-
50%{
|
|
179
|
-
transform: rotate(240deg);
|
|
180
|
-
}
|
|
181
|
-
100%{
|
|
182
|
-
transform: rotate(360deg);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
.load{
|
|
186
|
-
>.label{
|
|
187
|
-
display: inline-block;
|
|
188
|
-
animation: rotate 1s infinite;
|
|
189
|
-
}
|
|
190
|
-
|
|
1
|
+
& {
|
|
2
|
+
// background-color : #fff;
|
|
3
|
+
user-select: none;
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: 1;
|
|
6
|
+
padding: 4px 0;
|
|
7
|
+
line-height: 0;
|
|
8
|
+
-webkit-backdrop-filter: saturate(180%) blur(20px);
|
|
9
|
+
backdrop-filter: saturate(180%) blur(20px);
|
|
10
|
+
background: rgba(255, 255, 255, .7);
|
|
11
|
+
box-shadow: 0 0 6px -4px rgba(0, 0, 0, .3);
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
|
|
15
|
+
>div {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[insert] {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
position: sticky;
|
|
23
|
+
right: 0;
|
|
24
|
+
width: auto;
|
|
25
|
+
background: #fff;
|
|
26
|
+
background: linear-gradient(90deg, #fff0, #fff 10px);
|
|
27
|
+
background-clip: border-box;
|
|
28
|
+
z-index: 1;
|
|
29
|
+
right: 0;
|
|
30
|
+
padding-left: 10px;
|
|
31
|
+
margin-left: -10px;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.searchbox {
|
|
36
|
+
margin: 8px 10px;
|
|
37
|
+
vertical-align: middle;
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
float: right;
|
|
40
|
+
background-color: #f6f6f6;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
>.menu-items {
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
padding-left: 12px;
|
|
46
|
+
max-width: 100%;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.menu-item {
|
|
51
|
+
&:last-child {
|
|
52
|
+
margin-right: 12px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.menu-switch {
|
|
56
|
+
background-color: #F2B33F;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.menu-page {
|
|
60
|
+
background-color: #ccc;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.actived {
|
|
64
|
+
background-color: #5ad;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
border-radius : 18px;
|
|
68
|
+
background-color: #629aa9;
|
|
69
|
+
color : #fff;
|
|
70
|
+
position : relative;
|
|
71
|
+
display : inline-block;
|
|
72
|
+
width : 36px;
|
|
73
|
+
height : 36px;
|
|
74
|
+
line-height : 37px;
|
|
75
|
+
text-align : center;
|
|
76
|
+
margin-right : 10px;
|
|
77
|
+
overflow : visible;
|
|
78
|
+
|
|
79
|
+
>close {
|
|
80
|
+
position: absolute;
|
|
81
|
+
right: -12px;
|
|
82
|
+
top: -12px;
|
|
83
|
+
width: 24px;
|
|
84
|
+
height: 24px;
|
|
85
|
+
line-height: 24px;
|
|
86
|
+
text-align: center;
|
|
87
|
+
color: #666;
|
|
88
|
+
z-index: 2;
|
|
89
|
+
|
|
90
|
+
&:hover {
|
|
91
|
+
color: #f24;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
>span {
|
|
96
|
+
width: auto;
|
|
97
|
+
min-width: 20px;
|
|
98
|
+
height: 20px;
|
|
99
|
+
line-height: 20px;
|
|
100
|
+
text-align: center;
|
|
101
|
+
border-radius: 10px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// &:nth-child(2)>span {
|
|
105
|
+
// background-color: @primary-dot-color;
|
|
106
|
+
// }
|
|
107
|
+
|
|
108
|
+
// &:nth-child(3)>span {
|
|
109
|
+
// background-color: @extra-dot-color1;
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
// &:nth-child(4)>span {
|
|
113
|
+
// background-color: @extra-dot-color2;
|
|
114
|
+
// }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.option-items {
|
|
118
|
+
|
|
119
|
+
>* {
|
|
120
|
+
height: 60px;
|
|
121
|
+
line-height: 60px;
|
|
122
|
+
padding: 0 16px;
|
|
123
|
+
vertical-align: top;
|
|
124
|
+
// background : transparent;
|
|
125
|
+
// color : black;
|
|
126
|
+
margin-left: 10px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.user-name {
|
|
131
|
+
height: 60px;
|
|
132
|
+
text-align: left;
|
|
133
|
+
|
|
134
|
+
p {
|
|
135
|
+
line-height: 14px;
|
|
136
|
+
margin: 10px 0;
|
|
137
|
+
font-size: 14px;
|
|
138
|
+
color: #F2B33F;
|
|
139
|
+
font-weight: 700;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
span {
|
|
143
|
+
font-size: 12px;
|
|
144
|
+
line-height: 12px;
|
|
145
|
+
color: #424f63;
|
|
146
|
+
font-weight: normal;
|
|
147
|
+
vertical-align: top;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.userinfo {
|
|
152
|
+
height: 59px;
|
|
153
|
+
vertical-align: top;
|
|
154
|
+
background: transparent;
|
|
155
|
+
color: #ccc;
|
|
156
|
+
box-shadow: none;
|
|
157
|
+
|
|
158
|
+
>* {
|
|
159
|
+
display: inline-block;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
img {
|
|
163
|
+
vertical-align: top;
|
|
164
|
+
border-radius: 50%;
|
|
165
|
+
height: 50px;
|
|
166
|
+
width: 50px;
|
|
167
|
+
margin: 5px;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
btn {
|
|
172
|
+
vertical-align: top;
|
|
173
|
+
}
|
|
174
|
+
@keyframes rotate {
|
|
175
|
+
0%{
|
|
176
|
+
transform: rotate(0deg);
|
|
177
|
+
}
|
|
178
|
+
50%{
|
|
179
|
+
transform: rotate(240deg);
|
|
180
|
+
}
|
|
181
|
+
100%{
|
|
182
|
+
transform: rotate(360deg);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
.load{
|
|
186
|
+
>.label{
|
|
187
|
+
display: inline-block;
|
|
188
|
+
animation: rotate 1s infinite;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
191
|
}
|
package/coms/pivot/DB.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var client_id
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gid => DB`商品${gid}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<div ng-class="{even:i&1,odd:!(i&1)}" v-for="(r,i) in rates" hz:='r[5]'>
|
|
2
|
-
<span ng-if="!(i&1)" v-bind="i/2 -8"></span>
|
|
3
|
-
<button ng-repeat="o in r" _rate=o>
|
|
4
|
-
<span ng-bind="format(o)"></span>
|
|
5
|
-
</button>
|
|
1
|
+
<div ng-class="{even:i&1,odd:!(i&1)}" v-for="(r,i) in rates" hz:='r[5]'>
|
|
2
|
+
<span ng-if="!(i&1)" v-bind="i/2 -8"></span>
|
|
3
|
+
<button ng-repeat="o in r" _rate=o>
|
|
4
|
+
<span ng-bind="format(o)"></span>
|
|
5
|
+
</button>
|
|
6
6
|
</div>
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
function piano() {
|
|
2
|
-
var res = [];
|
|
3
|
-
var yin = [1, 3, 5, 7, 8, 10, 12].reverse();
|
|
4
|
-
var yue = [2, 4, 6, 9, 11].reverse();
|
|
5
|
-
var c = a => 440 * Math.pow(2, cx + (3 - a) / 12);
|
|
6
|
-
for (var cx = -12, dx = 8; cx < dx; cx++) {
|
|
7
|
-
var yinjie1 = yin.map(c);
|
|
8
|
-
var yinjie2 = yue.map(c);
|
|
9
|
-
res.push(yinjie1, yinjie2);
|
|
10
|
-
}
|
|
11
|
-
return res;
|
|
12
|
-
}
|
|
13
|
-
function main() {
|
|
14
|
-
var page = document.createElement('div');
|
|
15
|
-
page.innerHTML = AudioContext_test;
|
|
16
|
-
var mouse_target = null;
|
|
17
|
-
var setBuffer = function (btn) {
|
|
18
|
-
var { gainNode, audioCtx, oscillator } = btn;
|
|
19
|
-
var gain = gainNode.gain;
|
|
20
|
-
var hz = btn.rate;
|
|
21
|
-
var currentTime = audioCtx.currentTime;
|
|
22
|
-
gain.setValueAtTime(65536 / Math.log2(hz), currentTime + 0.01);
|
|
23
|
-
// gain.linearRampToValueAtTime(0, currentTime + 2);
|
|
24
|
-
gain.exponentialRampToValueAtTime(0.001, currentTime + 1);
|
|
25
|
-
};
|
|
26
|
-
var init = function (btn) {
|
|
27
|
-
if (btn.audioCtx) {
|
|
28
|
-
return btn;
|
|
29
|
-
}
|
|
30
|
-
var audioCtx = btn.audioCtx = new AudioContext();
|
|
31
|
-
var gainNode = btn.gainNode = audioCtx.createGain();
|
|
32
|
-
var oscillator = btn.oscillator = audioCtx.createOscillator();
|
|
33
|
-
var hz = btn.rate;
|
|
34
|
-
oscillator.connect(gainNode);
|
|
35
|
-
gainNode.connect(audioCtx.destination);
|
|
36
|
-
oscillator.type = 'sine';
|
|
37
|
-
oscillator.frequency.value = -hz;
|
|
38
|
-
oscillator.start(0);
|
|
39
|
-
return { audioCtx, gainNode, oscillator };
|
|
40
|
-
};
|
|
41
|
-
var drop = function (btn) {
|
|
42
|
-
btn.oscillator.stop();
|
|
43
|
-
btn.audioCtx = null;
|
|
44
|
-
btn.gainNode = null;
|
|
45
|
-
btn.oscillator = null;
|
|
46
|
-
}
|
|
47
|
-
var click = {
|
|
48
|
-
start(event) {
|
|
49
|
-
var btn = event.target;
|
|
50
|
-
var btn = getTargetIn(b => hasClass(b, 'button'), event.target);
|
|
51
|
-
if (btn.pressed) return;
|
|
52
|
-
btn.pressed = true;
|
|
53
|
-
var { oscillator, audioCtx, gainNode } = init(btn);
|
|
54
|
-
setBuffer(btn);
|
|
55
|
-
audioCtx.resume();
|
|
56
|
-
addClass(btn, 'pending');
|
|
57
|
-
if (!event.touches) mouse_target = btn;
|
|
58
|
-
},
|
|
59
|
-
async end(event) {
|
|
60
|
-
if (!event.touches) var btn = mouse_target;
|
|
61
|
-
else var btn = getTargetIn(b => hasClass(b, 'button'), event.target);
|
|
62
|
-
if (!btn) return;
|
|
63
|
-
btn.pressed = false;
|
|
64
|
-
var { gainNode, oscillator, audioCtx } = btn;
|
|
65
|
-
if (!gainNode || !oscillator) return;
|
|
66
|
-
await audioCtx.suspend();
|
|
67
|
-
drop(btn);
|
|
68
|
-
removeClass(btn, 'pending');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
on("touchstart")(page, click.start);
|
|
72
|
-
on("touchend")(page, click.end);
|
|
73
|
-
on('mousedown')(page, click.start);
|
|
74
|
-
bind('mouseup')(page, click.end);
|
|
75
|
-
renderWithDefaults(page, {
|
|
76
|
-
rates: piano(),
|
|
77
|
-
audioCtx: null,
|
|
78
|
-
gainNode: null,
|
|
79
|
-
oscillator: null,
|
|
80
|
-
|
|
81
|
-
format(o) {
|
|
82
|
-
var i = o.toFixed(1).indexOf('.');
|
|
83
|
-
return o.toFixed(5 - i);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
on("mounted")(page, function () {
|
|
87
|
-
this.querySelector('[hz="440"]').scrollIntoViewIfNeeded();
|
|
88
|
-
});
|
|
89
|
-
on('contextmenu')(page, function (e) {
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
});
|
|
92
|
-
return page;
|
|
1
|
+
function piano() {
|
|
2
|
+
var res = [];
|
|
3
|
+
var yin = [1, 3, 5, 7, 8, 10, 12].reverse();
|
|
4
|
+
var yue = [2, 4, 6, 9, 11].reverse();
|
|
5
|
+
var c = a => 440 * Math.pow(2, cx + (3 - a) / 12);
|
|
6
|
+
for (var cx = -12, dx = 8; cx < dx; cx++) {
|
|
7
|
+
var yinjie1 = yin.map(c);
|
|
8
|
+
var yinjie2 = yue.map(c);
|
|
9
|
+
res.push(yinjie1, yinjie2);
|
|
10
|
+
}
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
13
|
+
function main() {
|
|
14
|
+
var page = document.createElement('div');
|
|
15
|
+
page.innerHTML = AudioContext_test;
|
|
16
|
+
var mouse_target = null;
|
|
17
|
+
var setBuffer = function (btn) {
|
|
18
|
+
var { gainNode, audioCtx, oscillator } = btn;
|
|
19
|
+
var gain = gainNode.gain;
|
|
20
|
+
var hz = btn.rate;
|
|
21
|
+
var currentTime = audioCtx.currentTime;
|
|
22
|
+
gain.setValueAtTime(65536 / Math.log2(hz), currentTime + 0.01);
|
|
23
|
+
// gain.linearRampToValueAtTime(0, currentTime + 2);
|
|
24
|
+
gain.exponentialRampToValueAtTime(0.001, currentTime + 1);
|
|
25
|
+
};
|
|
26
|
+
var init = function (btn) {
|
|
27
|
+
if (btn.audioCtx) {
|
|
28
|
+
return btn;
|
|
29
|
+
}
|
|
30
|
+
var audioCtx = btn.audioCtx = new AudioContext();
|
|
31
|
+
var gainNode = btn.gainNode = audioCtx.createGain();
|
|
32
|
+
var oscillator = btn.oscillator = audioCtx.createOscillator();
|
|
33
|
+
var hz = btn.rate;
|
|
34
|
+
oscillator.connect(gainNode);
|
|
35
|
+
gainNode.connect(audioCtx.destination);
|
|
36
|
+
oscillator.type = 'sine';
|
|
37
|
+
oscillator.frequency.value = -hz;
|
|
38
|
+
oscillator.start(0);
|
|
39
|
+
return { audioCtx, gainNode, oscillator };
|
|
40
|
+
};
|
|
41
|
+
var drop = function (btn) {
|
|
42
|
+
btn.oscillator.stop();
|
|
43
|
+
btn.audioCtx = null;
|
|
44
|
+
btn.gainNode = null;
|
|
45
|
+
btn.oscillator = null;
|
|
46
|
+
}
|
|
47
|
+
var click = {
|
|
48
|
+
start(event) {
|
|
49
|
+
var btn = event.target;
|
|
50
|
+
var btn = getTargetIn(b => hasClass(b, 'button'), event.target);
|
|
51
|
+
if (btn.pressed) return;
|
|
52
|
+
btn.pressed = true;
|
|
53
|
+
var { oscillator, audioCtx, gainNode } = init(btn);
|
|
54
|
+
setBuffer(btn);
|
|
55
|
+
audioCtx.resume();
|
|
56
|
+
addClass(btn, 'pending');
|
|
57
|
+
if (!event.touches) mouse_target = btn;
|
|
58
|
+
},
|
|
59
|
+
async end(event) {
|
|
60
|
+
if (!event.touches) var btn = mouse_target;
|
|
61
|
+
else var btn = getTargetIn(b => hasClass(b, 'button'), event.target);
|
|
62
|
+
if (!btn) return;
|
|
63
|
+
btn.pressed = false;
|
|
64
|
+
var { gainNode, oscillator, audioCtx } = btn;
|
|
65
|
+
if (!gainNode || !oscillator) return;
|
|
66
|
+
await audioCtx.suspend();
|
|
67
|
+
drop(btn);
|
|
68
|
+
removeClass(btn, 'pending');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
on("touchstart")(page, click.start);
|
|
72
|
+
on("touchend")(page, click.end);
|
|
73
|
+
on('mousedown')(page, click.start);
|
|
74
|
+
bind('mouseup')(page, click.end);
|
|
75
|
+
renderWithDefaults(page, {
|
|
76
|
+
rates: piano(),
|
|
77
|
+
audioCtx: null,
|
|
78
|
+
gainNode: null,
|
|
79
|
+
oscillator: null,
|
|
80
|
+
|
|
81
|
+
format(o) {
|
|
82
|
+
var i = o.toFixed(1).indexOf('.');
|
|
83
|
+
return o.toFixed(5 - i);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
on("mounted")(page, function () {
|
|
87
|
+
this.querySelector('[hz="440"]').scrollIntoViewIfNeeded();
|
|
88
|
+
});
|
|
89
|
+
on('contextmenu')(page, function (e) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
});
|
|
92
|
+
return page;
|
|
93
93
|
}
|