-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
7984 lines (6302 loc) · 196 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var dropzone = document.getElementById('dropzone');
$('.drop').on('dragover',function(event){
event.preventDefault();
})
dropzone.ondrop = function(e) {
var length = e.dataTransfer.items.length;
for (var i = 0; i < length; i++) {
var entry = e.dataTransfer.items[i].webkitGetAsEntry();
if (entry.isFile) {
alert('got file');
} else if (entry.isDirectory) {
alert('got dir');
}
}
e.preventDefault();
};
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
xmlToJson(xml) {
// Create the return object
let obj = {};
if (xml.nodeType === 1) { // element
// do attributes
if (xml.attributes.length > 0) {
obj['@attributes'] = {};
for (let j = 0; j < xml.attributes.length; j += 1) {
const attribute = xml.attributes.item(j);
obj['@attributes'][attribute.nodeName] = attribute.nodeValue;
}
}
} else if (xml.nodeType === 3) { // text
obj = xml.nodeValue;
}
// do children
// If just one text node inside
if (xml.hasChildNodes() && xml.childNodes.length === 1 && xml.childNodes[0].nodeType === 3) {
obj = xml.childNodes[0].nodeValue;
} else if (xml.hasChildNodes()) {
for (let i = 0; i < xml.childNodes.length; i += 1) {
const item = xml.childNodes.item(i);
const nodeName = item.nodeName;
if (typeof (obj[nodeName]) === 'undefined') {
obj[nodeName] = xmlToJson(item);
} else {
if (typeof (obj[nodeName].push) === 'undefined') {
const old = obj[nodeName];
obj[nodeName] = [];
obj[nodeName].push(old);
}
obj[nodeName].push(xmlToJson(item));
}
}
}
return obj;
},
$.getJSON(url , function(data) {
var tbl_body = document.createElement("tbody");
var odd_even = false;
$.each(data, function() {
var tbl_row = tbl_body.insertRow();
tbl_row.className = odd_even ? "odd" : "even";
$.each(this, function(k , v) {
var cell = tbl_row.insertCell();
cell.appendChild(document.createTextNode(v.toString()));
})
odd_even = !odd_even;
})
$("#target_table_id").appendChild(tbl_body);
});
var myList = [
{ "name": "abc", "age": 50 },
{ "age": "25", "hobby": "swimming" },
{ "name": "xyz", "hobby": "programming" }
];
// Builds the HTML Table out of myList.
function buildHtmlTable(selector) {
var columns = addAllColumnHeaders(myList, selector);
for (var i = 0; i < myList.length; i++) {
var row$ = $('<tr/>');
for (var colIndex = 0; colIndex < columns.length; colIndex++) {
var cellValue = myList[i][columns[colIndex]];
if (cellValue == null) cellValue = "";
row$.append($('<td/>').html(cellValue));
}
$(selector).append(row$);
}
}
// Adds a header row to the table and returns the set of columns.
// Need to do union of keys from all records as some records may not contain
// all records.
function addAllColumnHeaders(myList, selector) {
var columnSet = [];
var headerTr$ = $('<tr/>');
for (var i = 0; i < myList.length; i++) {
var rowHash = myList[i];
for (var key in rowHash) {
if ($.inArray(key, columnSet) == -1) {
columnSet.push(key);
headerTr$.append($('<th/>').html(key));
}
}
}
$(selector).append(headerTr$);
return columnSet;
}
var myList=[{"name": "abc","age": 50},{"name": {"1": "piet","2": "jan","3": "klaas"},"age": "25","hobby": "watching tv"},{"name": "xyz","hobby": "programming","subtable": [{"a": "a","b": "b"},{"a": "a","b": "b"}]}];
// Builds the HTML Table out of myList json data from Ivy restful service.
function buildHtmlTable() {
addTable(myList, $("#excelDataTable"));
}
function addTable(list, appendObj) {
var columns = addAllColumnHeaders(list, appendObj);
for (var i = 0; i < list.length; i++) {
var row$ = $('<tr/>');
for (var colIndex = 0; colIndex < columns.length; colIndex++) {
var cellValue = list[i][columns[colIndex]];
if (cellValue == null) {
cellValue = "";
}
if (cellValue.constructor === Array)
{
$a = $('<td/>');
row$.append($a);
addTable(cellValue, $a);
} else if (cellValue.constructor === Object)
{
var array = $.map(cellValue, function (value, index) {
return [value];
});
$a = $('<td/>');
row$.append($a);
addObject(array, $a);
} else {
row$.append($('<td/>').html(cellValue));
}
}
appendObj.append(row$);
}
}
function addObject(list, appendObj) {
for (var i = 0; i < list.length; i++) {
var row$ = $('<tr/>');
var cellValue = list[i];
if (cellValue == null) {
cellValue = "";
}
if (cellValue.constructor === Array)
{
$a = $('<td/>');
row$.append($a);
addTable(cellValue, $a);
} else if (cellValue.constructor === Object)
{
var array = $.map(cellValue, function (value, index) {
return [value];
});
$a = $('<td/>');
row$.append($a);
addObject(array, $a);
} else {
row$.append($('<td/>').html(cellValue));
}
appendObj.append(row$);
}
}
// Adds a header row to the table and returns the set of columns.
// Need to do union of keys from all records as some records may not contain
// all records
function addAllColumnHeaders(list, appendObj)
{
var columnSet = [];
var headerTr$ = $('<tr/>');
for (var i = 0; i < list.length; i++) {
var rowHash = list[i];
for (var key in rowHash) {
if ($.inArray(key, columnSet) == -1) {
columnSet.push(key);
headerTr$.append($('<th/>').html(key));
}
}
}
appendObj.append(headerTr$);
return columnSet;
}
LUA_SD_EVENT=/writescript.lua
UPDIR=/DCIM
command.cgi?op=121&TIME=1234...
// During long uploads, polling requests were stacking up behind the upload
// We add an active flag. The flag prevents new requests from going
// out while one is active.
var polling_active = false;
var poll_counter = 0;
function polling() {
if(polling_active && poll_counter-- <= 0) {
return;
}
polling_active = true;
poll_counter = 12;
var url="/command.cgi?op=121&TIME="+(Date.now());
$.get(url).done(function(data, textStatus, jqXHR){
polling_active = false;
if(last_update_time < Number(data)) {
last_update_time = Number(data);
getFileList(last_dirpath);
$("#reloadtime").html("<font color=red>"+(new Date()).toLocaleString())+"</font>";
}else{
$("#reloadtime").html((new Date()).toLocaleString());
}
}).fail(function(jqXHR, textStatus, errorThrown){
polling_active = false;
//失敗した場合:エラー内容を表示
$("#reloadtime").html("<font color=red>Error:"+textStatus+"</font>");
});
}
// Fix rotates (or at least try)
var rotates = document.getElementsByClassName('rotm90');
for (var i = 0; i < rotates.length; i++) {
let ow = rotates[i].offsetWidth;
let oh = rotates[i].offsetHeight;
rotates[i].style.width = oh + 'px';
rotates[i].style.height = ow + 'px';
}
.rotm90 {
/* Safari */
-webkit-transform: rotate(-90deg);
/* Firefox */
-moz-transform: rotate(-90deg);
/* IE */
-chrome-transform: rotate(-90deg);
}
function plotTrack(track, obj) {
// first walk the track and find min and max y positions
let ymin = 100000;
let ymax = -1000000;
let rowList = forceArray(track.noteRows);
for (var row : rowList) {
var noteList = forceArray(row.notes);
for (var n : noteList) {
let y = n.y;
if (y < ymin) ymin = y;
if (y > ymax) ymax = y;
}
}
}
0]="]TR-808
1]="]DDD-1
2]="]SDS-5
3]="]TR-909
4]="]R-50
5]="]R-100
6]="]LD
7]="]HR-16B
8]="]SCDT
9]="]RX-5
1]="0 XV-5080
11 KR-55
12 HR-II
13 AT Rhythm
14 CR-78
30]="Chaz Bundick
31]="Reuben Winter
32]="Kody Nielson
33]="Alfred Darlington
34]="Travis Egedy
35]="Sjionel Timu
36]="Stefanie Franciotti
37]="Stephanie Engelbrecht
38]="Jonathan Snipes (FX)
39]="Campbell Kneale
40]="John Atkinson
41]="Jonathan Snipes (Waterfalls)
42]="Phil Elverum
]="
/*
if(jsong.tracks) {
let trax = forceArray(jsong.tracks.track);
if (trax) {
for(var i = 0; i < trax.length; ++i) {
obj.append($("<h3/>").text("Track number " + (i + 1)));
jsonToTable(trax[i], obj);
}
}
}
*/
Just because you can doesn't mean you should — clipboard.js
{clipboardEnabled ? <CopyToClipButton title='→ Clip' getText={this.copySel.bind(this)}/> : null}
$(document).ready(function() {
https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
function copyTextToClipboard(text) {
var textArea = document.createElement("textarea");
//
// *** This styling is an extra step which is likely not required. ***
//
// Why is it here? To ensure:
// 1. the element is able to have focus and selection.
// 2. if element was to flash render it has minimal visual impact.
// 3. less flakyness with selection and copying which **might** occur if
// the textarea element is not visible.
//
// The likelihood is the element won't even render, not even a flash,
// so some of these are just precautions. However in IE the element
// is visible whilst the popup box asking the user for permission for
// the web page to copy to the clipboard.
//
// Place in top-left corner of screen regardless of scroll position.
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
// Ensure it has a small width and height. Setting to 1px / 1em
// doesn't work as this gives a negative w/h on some browsers.
textArea.style.width = '2em';
textArea.style.height = '2em';
// We don't need padding, reducing the size if it does flash render.
textArea.style.padding = 0;
// Clean up any borders.
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
// Avoid flash of white box if rendered for any reason.
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
} catch (err) {
console.log('Oops, unable to copy');
}
document.body.removeChild(textArea);
}
var copyBobBtn = document.querySelector('.js-copy-bob-btn'),
copyJaneBtn = document.querySelector('.js-copy-jane-btn');
copyBobBtn.addEventListener('click', function(event) {
copyTextToClipboard('Bob');
});
copyJaneBtn.addEventListener('click', function(event) {
copyTextToClipboard('Jane');
});
<div style="display:inline-block; vertical-align:top;">
<button class="js-copy-bob-btn">Set clipboard to BOB</button><br /><br />
<button class="js-copy-jane-btn">Set clipboard to JANE</button>
</div>
<div style="display:inline-block;">
<textarea class="js-test-textarea" cols="35" rows="4">Try pasting into here to see what you have on your clipboard:
</textarea>
</div>
// Copies a string to the clipboard. Must be called from within an
// event handler such as click. May return false if it failed, but
// this is not always possible. Browser support for Chrome 43+,
// Firefox 42+, Safari 10+, Edge and IE 10+.
// IE: The clipboard feature may be disabled by an administrator. By
// default a prompt is shown the first time the clipboard is
// used (per session).
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
// IE specific code path to prevent textarea being shown while dialog is visible.
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge.
document.body.appendChild(textarea);
textarea.select();
try {
return document.execCommand("copy"); // Security exception may be thrown by some browsers.
} catch (ex) {
console.warn("Copy to clipboard failed.", ex);
return false;
} finally {
document.body.removeChild(textarea);
}
}
}
Paste example (requires existing selected field).
$(ElementId).bind('copy', function(event) {
var selectedText = window.getSelection().toString();
selectedText = selectedText.replace(/\u200B/g, "");
clipboardData = event.clipboardData || window.clipboardData || event.originalEvent.clipboardData;
clipboardData.setData('text/html', selectedText);
event.preventDefault();
});
json.song
new Clipboard('.clipbtn', {
text: function(trigger) {
return asText;
}
});
<notes>
</notes>
https://stackoverflow.com/questions/201183/how-to-determine-equality-for-two-javascript-objects
function objectEquals(x, y) {
'use strict';
if (x === null || x === undefined || y === null || y === undefined) { return x === y; }
// after this just checking type of one would be enough
if (x.constructor !== y.constructor) { return false; }
// if they are functions, they should exactly refer to same one (because of closures)
if (x instanceof Function) { return x === y; }
// if they are regexps, they should exactly refer to same one (it is hard to better equality check on current ES)
if (x instanceof RegExp) { return x === y; }
if (x === y || x.valueOf() === y.valueOf()) { return true; }
if (Array.isArray(x) && x.length !== y.length) { return false; }
// if they are dates, they must had equal valueOf
if (x instanceof Date) { return false; }
// if they are strictly equal, they both need to be object at least
if (!(x instanceof Object)) { return false; }
if (!(y instanceof Object)) { return false; }
// recursive object equality check
var p = Object.keys(x);
return Object.keys(y).every(function (i) { return p.indexOf(i) !== -1; }) &&
p.every(function (i) { return objectEquals(x[i], y[i]); });
}
///////////////////////////////////////////////////////////////
/// The borrowed tests, run them by clicking "Run code snippet"
///////////////////////////////////////////////////////////////
var printResult = function (x) {
if (x) { document.write('<div style="color: green;">Passed</div>'); }
else { document.write('<div style="color: red;">Failed</div>'); }
};
var assert = { isTrue: function (x) { printResult(x); }, isFalse: function (x) { printResult(!x); } }
assert.isTrue(objectEquals(null,null));
assert.isFalse(objectEquals(null,undefined));
assert.isFalse(objectEquals(/abc/, /abc/));
assert.isFalse(objectEquals(/abc/, /123/));
var r = /abc/;
assert.isTrue(objectEquals(r, r));
assert.isTrue(objectEquals("hi","hi"));
assert.isTrue(objectEquals(5,5));
assert.isFalse(objectEquals(5,10));
assert.isTrue(objectEquals([],[]));
assert.isTrue(objectEquals([1,2],[1,2]));
assert.isFalse(objectEquals([1,2],[2,1]));
assert.isFalse(objectEquals([1,2],[1,2,3]));
assert.isTrue(objectEquals({},{}));
assert.isTrue(objectEquals({a:1,b:2},{a:1,b:2}));
assert.isTrue(objectEquals({a:1,b:2},{b:2,a:1}));
assert.isFalse(objectEquals({a:1,b:2},{a:1,b:3}));
assert.isTrue(objectEquals({1:{name:"mhc",age:28}, 2:{name:"arb",age:26}},{1:{name:"mhc",age:28}, 2:{name:"arb",age:26}}));
assert.isFalse(objectEquals({1:{name:"mhc",age:28}, 2:{name:"arb",age:26}},{1:{name:"mhc",age:28}, 2:{name:"arb",age:27}}));
Object.prototype.equals = function (obj) { return objectEquals(this, obj); };
var assertFalse = assert.isFalse,
assertTrue = assert.isTrue;
assertFalse({}.equals(null));
assertFalse({}.equals(undefined));
assertTrue("hi".equals("hi"));
assertTrue(new Number(5).equals(5));
assertFalse(new Number(5).equals(10));
assertFalse(new Number(1).equals("1"));
assertTrue([].equals([]));
assertTrue([1,2].equals([1,2]));
assertFalse([1,2].equals([2,1]));
assertFalse([1,2].equals([1,2,3]));
assertTrue(new Date("2011-03-31").equals(new Date("2011-03-31")));
assertFalse(new Date("2011-03-31").equals(new Date("1970-01-01")));
assertTrue({}.equals({}));
assertTrue({a:1,b:2}.equals({a:1,b:2}));
assertTrue({a:1,b:2}.equals({b:2,a:1}));
assertFalse({a:1,b:2}.equals({a:1,b:3}));
assertTrue({1:{name:"mhc",age:28}, 2:{name:"arb",age:26}}.equals({1:{name:"mhc",age:28}, 2:{name:"arb",age:26}}));
assertFalse({1:{name:"mhc",age:28}, 2:{name:"arb",age:26}}.equals({1:{name:"mhc",age:28}, 2:{name:"arb",age:27}}));
var a = {a: 'text', b:[0,1]};
var b = {a: 'text', b:[0,1]};
var c = {a: 'text', b: 0};
var d = {a: 'text', b: false};
var e = {a: 'text', b:[1,0]};
var i = {
a: 'text',
c: {
b: [1, 0]
}
};
var j = {
a: 'text',
c: {
b: [1, 0]
}
};
var k = {a: 'text', b: null};
var l = {a: 'text', b: undefined};
assertTrue(a.equals(b));
assertFalse(a.equals(c));
assertFalse(c.equals(d));
assertFalse(a.equals(e));
assertTrue(i.equals(j));
assertFalse(d.equals(k));
assertFalse(k.equals(l));
// from comments on stackoverflow post
assert.isFalse(objectEquals([1, 2, undefined], [1, 2]));
assert.isFalse(objectEquals([1, 2, 3], { 0: 1, 1: 2, 2: 3 }));
assert.isFalse(objectEquals(new Date(1234), 1234));
// no two different function is equal really, they capture their context variables
// so even if they have same toString(), they won't have same functionality
var func = function (x) { return true; };
var func2 = function (x) { return true; };
assert.isTrue(objectEquals(func, func));
assert.isFalse(objectEquals(func, func2));
assert.isTrue(objectEquals({ a: { b: func } }, { a: { b: func } }));
assert.isFalse(objectEquals({ a: { b: func } }, { a: { b: func2 } }));
var x = eval("(" + remoteJSON + ')');
var y = eval("(" + localJSON + ')');
// https://stackoverflow.com/users/2215072/drwhite
// https://stackoverflow.com/questions/26049303/how-to-compare-two-json-have-the-same-properties-without-order
function jsonequals(x, y) {
// If both x and y are null or undefined and exactly the same
if ( x === y ) {
return true;
}
// If they are not strictly equal, they both need to be Objects
if ( ! ( x instanceof Object ) || ! ( y instanceof Object ) ) {
return false;
}
// They must have the exact same prototype chain, the closest we can do is
// test the constructor.
if ( x.constructor !== y.constructor ) {
return false;
}
for ( var p in x ) {
// Inherited properties were tested using x.constructor === y.constructor
if ( x.hasOwnProperty( p ) ) {
// Allows comparing x[ p ] and y[ p ] when set to undefined
if ( ! y.hasOwnProperty( p ) ) {
return false;
}
// If they have the same strict value or identity then they are equal
if ( x[ p ] === y[ p ] ) {
continue;
}
// Numbers, Strings, Functions, Booleans must be strictly equal
if ( typeof( x[ p ] ) !== "object" ) {
return false;
}
// Objects and Arrays must be tested recursively
if ( !equals( x[ p ], y[ p ] ) ) {
return false;
}
}
}
for ( p in y ) {
// allows x[ p ] to be set to undefined
if ( y.hasOwnProperty( p ) && ! x.hasOwnProperty( p ) ) {
return false;
}
}
return true;
}
function objectEquals(x, y) {
// if both are function
if (x instanceof Function) {
if (y instanceof Function) {
return x.toString() === y.toString();
}
return false;
}
if (x === null || x === undefined || y === null || y === undefined) { return x === y; }
if (x === y || x.valueOf() === y.valueOf()) { return true; }
// if one of them is date, they must had equal valueOf
if (x instanceof Date) { return false; }
if (y instanceof Date) { return false; }
// if they are not function or strictly equal, they both need to be Objects
if (!(x instanceof Object)) { return false; }
if (!(y instanceof Object)) { return false; }
var p = Object.keys(x);
return Object.keys(y).every(function (i) { return p.indexOf(i) !== -1; }) ?
p.every(function (i) { return objectEquals(x[i], y[i]); }) : false;
}
// Returns short cut pathways for populating the value display table
var shortCutTab = Array(8);
for(var i = 0; i < shortCutTab.length; ++i) shortCutTab[i] = Array(16);
function genValueArray(json)
{
}
if (hideShow === "▼") {
e.target.textContent = "►";
} else if(json['sound']) {
formatSound(json.sound, obj, true);
} else if(json['kit']) {
let kitroot = json['kit'];
if (json['soundSources']) kitroot = json;
formatKit(kitroot, obj, true);
} else {
jsonToTable(json, obj);
}
}
function viewSound(e) {
let trn = Number(e.target.getAttribute('trackno'));
let hideShow = e.target.textContent;
let songJ = jsonDocument.song;
if (!songJ) return;
let trackA = forceArray(songJ.tracks.track);
let trackIX = trackA.length - trn - 1;
let trackD = trackA[trackIX];
// Follow any indirect reference
if (trackD.instrument && trackD.instrument.referToTrackId !== undefined) {
let fromID = Number(trackD.instrument.referToTrackId);
trackD = trackA[fromID];
}
let divID = '#snd_place' + trn;
let where = $(divID);
if (hideShow === "▼") {
e.target.textContent = "►";
$(where)[0].innerHTML = "";
} else {
if (trackD.soundParams) {
e.target.textContent = "▼";
let sp = trackD.soundParams;
formatSound(sp, where);
} else if (trackD.kit) {
e.target.textContent = "▼";
let kitroot = trackD.kit;
if (trackD['soundSources']) {
kitroot = trackD;
}
formatKit(kitroot, where);
}
}
}
<reverb>
<roomSize>1288490496</roomSize>
<dampening>1546188288</dampening>
<width>2147483647</width>
<pan>0</pan>
<compressor>
<attack>327244</attack>
<release>936</release>
<volume>-21474836</volume>
<syncLevel>6</syncLevel>
</compressor>
</reverb>
"lpfResonance": "0xAE0000000400000000000000AE000000000000C0",
.sound_grid td {
border-bottom-style: double;
border-bottom-width: 3px;
}
// Recur down a JSON object, replacing all string values that
// contain hexidecimal constants with numbers
function cleanUpParams(json, formatters) {
for (var k in json) {
if(json.hasOwnProperty(k)) {
if(formatters && formatters[k]) {
let v = formatters[k](json, k);
json[k] = v;
continue;
}
let v = json[k];
if (v.constructor === Array) {
for(var ix = 0; ix < v.length; ++ix) {
cleanUpParams(v[ix], formatters);
}
} else if(v.constructor === Object) {
cleanUpParams(v);
} else
if(typeof v === "string") {
if (v.startsWith('0x')) {
let asInt= parseInt(v.substring(2, 10), 16);
// Convert to signed 32 bit.
if (asInt & 0x80000000) {
asInt -= 0x100000000;
}
let ranged = Math.round( ((asInt + 0x80000000) * 50) / 0x100000000) ;
json[k] = ranged;
//console.log(k + " converting: " + v + " to: " + ranged);
}
}
}
}
}
function fixRebParm(v) {
if(typeof v === "string" && v.startsWith('0x')) return v;
let vn = Number(v);
let ranged = Math.round( (vn * 50) / 0x7FFFFFFF);
return ranged;
}
function cleanUpReverb(json) {
let reverb = json.reverb;
if(reverb) {
reverb.roomSize = fixRebParm(reverb.roomSize);
reverb.dampening = fixRebParm(reverb.dampening);
reverb.width = fixRebParm(reverb.width);
let fpan = fixRebParm(reverb.pan);
reverb.pan = fpan; // - 25;
}
}
/*
function formatTime(tv)
{
let t = Number(tv) / 1000;
let v = t.toFixed(3);
return v;
}
*/
modulator2.toModulator1
osc2.oscillatorSync = 1
<arpeggiatorGate>0x00000000</arpeggiatorGate>
"arpeggiator": {
"mode": "up",
"numOctaves": "2",
"syncLevel": "6"
},
arpeggiator.mode
arpeggiator.numOctaves
arpeggiator.syncLevel
<delay>
<pingPong>0</pingPong>
<analog>1</analog>
<syncLevel>7</syncLevel>
</delay>
delay.pingPong
delay.analog
delay.syncLevel
<patchCable>
<source>lfo1</source>
<destination>pitch</destination>
<amount>0x1333332C</amount>
</patchCable>
STA_RETRY_CT=0
UPLOAD=1
WEBDAV=2
APPAUTOTIME=0
APPMODE=4
LUA_RUN_SCRIPT=/DR/checkflag.lua
/**
* Performs a binary search on the host array. This method can either be
* injected into Array.prototype or called with a specified scope like this:
* binaryIndexOf.call(someArray, searchElement);
*
* @param {*} searchElement The item to search for within the array.
* @return {Number} The index of the element which defaults to -1 when not found.
*/
function binaryIndexOf(tab, seek) {
'use strict';
var minX = 0;
var maxX= tab.length - 1;
var curX;
var curItem;
while (minX <= maxX) {
curX = (minX + maxX) / 2 | 0;
curItem = this[curX];
if (curItem > seek) {
minIndex = curX + 1;
}
else if (curItem < seek) {
maxIndex = curX - 1;
}
else {
return tab[curX];
}
}
return tab[minX];
}
0x1FED79C218D30E1080000002D200000080000014D40000008000001C1200000080000038200000008000003E3A0000008000004E3E0000008000004F460000008000005448000000800000574E0000008000005A560000008000005F5A000000800000635E000000800000656200000080000069640000008000006A640000008000007D64000000800000A64BBBFE28800000B127092320800000BE
1FED79C2
18D30E10
80000002
D2000000
80000014
D4000000
8000001C
12000000
80000038
20000000
8000003E
3A000000
8000004E
3E000000
8000004F
46000000
80000054
48000000
80000057
4E000000
8000005A
56000000
8000005F
5A000000
80000063
5E000000
80000065
62000000
80000069
64000000
8000006A
64000000
8000007D
64000000
800000A6
4BBBFE28
800000B1
27092320
800000BE
if(e.data.func == "clearResponse")
{
clrRes();
}
if(e.data.func == "setResponse")
{
setRes(e.data.arg);
}
// Clear Response
function clrRes()
{
respons_output.innerHTML = "Response";