abcjs 6.0.0-beta.7 → 6.0.0
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/.github/workflows/tests.yml +29 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/CONTRIBUTING.md +1 -0
- package/LICENSE.md +1 -1
- package/README.md +92 -3
- package/RELEASE.md +957 -1
- package/abcjs-audio.css +14 -5
- package/dist/.gitignore +1 -2
- package/dist/abcjs-basic-min.js +3 -0
- package/dist/abcjs-basic-min.js.LICENSE +23 -0
- package/dist/abcjs-basic.js +28231 -0
- package/dist/abcjs-basic.js.map +1 -0
- package/dist/abcjs-plugin-min.js +3 -0
- package/dist/abcjs-plugin-min.js.LICENSE +23 -0
- package/dist/report-basic.html +37 -0
- package/dist/report-before-glyph-compress.html +37 -0
- package/dist/report-brown-ts-target-es5.html +37 -0
- package/dist/report-dev-orig-no-babel.html +37 -0
- package/dist/report-synth.html +37 -0
- package/docker-build.sh +1 -0
- package/glyphs.json +1 -0
- package/index.js +27 -2
- package/{static-wrappers/license.js → license.js} +1 -1
- package/package.json +26 -29
- package/{src/plugin/abc_plugin.js → plugin.js} +31 -19
- package/src/api/abc_animation.js +1 -17
- package/src/api/abc_tablatures.js +144 -0
- package/src/api/abc_timing_callbacks.js +234 -116
- package/src/api/abc_tunebook.js +18 -67
- package/src/api/abc_tunebook_svg.js +38 -46
- package/src/data/abc_tune.js +232 -972
- package/src/data/deline-tune.js +199 -0
- package/src/edit/abc_editarea.js +112 -0
- package/src/edit/abc_editor.js +95 -221
- package/src/midi/abc_midi_create.js +48 -50
- package/src/parse/abc_common.js +0 -14
- package/src/parse/abc_parse.js +167 -1321
- package/src/parse/abc_parse_book.js +62 -0
- package/src/parse/abc_parse_directive.js +164 -41
- package/src/parse/abc_parse_header.js +116 -145
- package/src/parse/abc_parse_key_voice.js +26 -20
- package/src/parse/abc_parse_music.js +1337 -0
- package/src/parse/abc_tokenizer.js +21 -15
- package/src/parse/abc_transpose.js +3 -15
- package/src/parse/tune-builder.js +896 -0
- package/src/parse/wrap_lines.js +205 -453
- package/src/synth/abc_midi_flattener.js +1292 -0
- package/src/{midi → synth}/abc_midi_renderer.js +44 -17
- package/src/synth/abc_midi_sequencer.js +648 -0
- package/src/synth/active-audio-context.js +3 -14
- package/src/synth/cents-to-factor.js +10 -0
- package/src/synth/create-note-map.js +21 -32
- package/src/synth/create-synth-control.js +20 -103
- package/src/synth/create-synth.js +185 -77
- package/src/synth/download-buffer.js +7 -21
- package/src/synth/get-midi-file.js +13 -20
- package/src/synth/images/{loading.svg → loading.svg.js} +4 -0
- package/src/synth/images/loop.svg.js +65 -0
- package/src/synth/images/pause.svg.js +10 -0
- package/src/synth/images/play.svg.js +9 -0
- package/src/synth/images/{reset.svg → reset.svg.js} +5 -1
- package/src/synth/instrument-index-to-name.js +1 -16
- package/src/synth/load-note.js +37 -76
- package/src/synth/pitch-to-note-name.js +0 -15
- package/src/synth/pitches-to-perc.js +64 -0
- package/src/synth/place-note.js +78 -68
- package/src/synth/play-event.js +17 -18
- package/src/synth/register-audio-context.js +11 -23
- package/src/synth/sounds-cache.js +0 -15
- package/src/synth/supports-audio.js +9 -23
- package/src/synth/synth-controller.js +80 -49
- package/src/synth/synth-sequence.js +20 -34
- package/src/tablatures/instruments/guitar/guitar-fonts.js +19 -0
- package/src/tablatures/instruments/guitar/guitar-patterns.js +23 -0
- package/src/tablatures/instruments/guitar/tab-guitar.js +50 -0
- package/src/tablatures/instruments/string-patterns.js +277 -0
- package/src/tablatures/instruments/string-tablature.js +56 -0
- package/src/tablatures/instruments/tab-note.js +282 -0
- package/src/tablatures/instruments/tab-notes.js +41 -0
- package/src/tablatures/instruments/violin/tab-violin.js +47 -0
- package/src/tablatures/instruments/violin/violin-fonts.js +19 -0
- package/src/tablatures/instruments/violin/violin-patterns.js +23 -0
- package/src/tablatures/tab-absolute-elements.js +310 -0
- package/src/tablatures/tab-common.js +29 -0
- package/src/tablatures/tab-renderer.js +243 -0
- package/src/tablatures/transposer.js +110 -0
- package/src/test/abc_midi_lint.js +5 -22
- package/src/test/abc_midi_sequencer_lint.js +11 -14
- package/src/test/abc_parser_lint.js +136 -32
- package/src/test/abc_vertical_lint.js +94 -32
- package/src/test/rendering-lint.js +38 -5
- package/src/write/abc_absolute_element.js +112 -120
- package/src/write/abc_abstract_engraver.js +102 -253
- package/src/write/abc_beam_element.js +30 -290
- package/src/write/abc_brace_element.js +12 -121
- package/src/write/abc_create_clef.js +21 -32
- package/src/write/abc_create_key_signature.js +8 -26
- package/src/write/abc_create_note_head.js +107 -0
- package/src/write/abc_create_time_signature.js +2 -21
- package/src/write/abc_crescendo_element.js +3 -50
- package/src/write/abc_decoration.js +7 -30
- package/src/write/abc_dynamic_decoration.js +3 -37
- package/src/write/abc_ending_element.js +1 -57
- package/src/write/abc_engraver_controller.js +111 -234
- package/src/write/abc_glyphs.js +9 -19
- package/src/write/abc_relative_element.js +57 -97
- package/src/write/abc_renderer.js +10 -832
- package/src/write/abc_spacing.js +0 -15
- package/src/write/abc_staff_group_element.js +14 -349
- package/src/write/abc_tempo_element.js +9 -117
- package/src/write/abc_tie_element.js +5 -68
- package/src/write/abc_triplet_element.js +6 -124
- package/src/write/abc_voice_element.js +7 -222
- package/src/write/add-chord.js +103 -0
- package/src/write/add-text-if.js +33 -0
- package/src/write/bottom-text.js +79 -0
- package/src/write/calcHeight.js +17 -0
- package/src/write/classes.js +100 -0
- package/src/write/draw/absolute.js +68 -0
- package/src/write/draw/beam.js +56 -0
- package/src/write/draw/brace.js +106 -0
- package/src/write/draw/crescendo.js +38 -0
- package/src/write/draw/debug-box.js +8 -0
- package/src/write/draw/draw.js +56 -0
- package/src/write/draw/dynamics.js +20 -0
- package/src/write/draw/ending.js +46 -0
- package/src/write/draw/group-elements.js +66 -0
- package/src/write/draw/horizontal-line.js +25 -0
- package/src/write/draw/non-music.js +50 -0
- package/src/write/draw/print-line.js +24 -0
- package/src/write/draw/print-path.js +7 -0
- package/src/write/draw/print-stem.js +30 -0
- package/src/write/draw/print-symbol.js +59 -0
- package/src/write/draw/print-vertical-line.js +18 -0
- package/src/write/draw/relative.js +77 -0
- package/src/write/draw/round-number.js +5 -0
- package/src/write/draw/selectables.js +59 -0
- package/src/write/draw/separator.js +16 -0
- package/src/write/draw/set-paper-size.js +45 -0
- package/src/write/{sprintf.js → draw/sprintf.js} +0 -0
- package/src/write/draw/staff-group.js +226 -0
- package/src/write/draw/staff-line.js +9 -0
- package/src/write/draw/staff.js +33 -0
- package/src/write/draw/tab-line.js +40 -0
- package/src/write/draw/tempo.js +45 -0
- package/src/write/draw/text.js +71 -0
- package/src/write/draw/tie.js +97 -0
- package/src/write/draw/triplet.js +46 -0
- package/src/write/draw/voice.js +102 -0
- package/src/write/format-jazz-chord.js +15 -0
- package/src/write/free-text.js +41 -0
- package/src/write/get-font-and-attr.js +37 -0
- package/src/write/get-text-size.js +56 -0
- package/src/write/highlight.js +11 -0
- package/src/write/layout/VoiceElements.js +121 -0
- package/src/write/layout/beam.js +213 -0
- package/src/write/layout/get-left-edge-of-staff.js +56 -0
- package/src/write/layout/getBarYAt.js +6 -0
- package/src/write/layout/layout.js +94 -0
- package/src/write/layout/setUpperAndLowerElements.js +232 -0
- package/src/write/layout/staffGroup.js +146 -0
- package/src/write/layout/triplet.js +75 -0
- package/src/write/layout/voice.js +137 -0
- package/src/write/selection.js +188 -70
- package/src/write/separator.js +10 -0
- package/src/write/set-class.js +21 -0
- package/src/write/subtitle.js +12 -0
- package/src/write/svg.js +95 -43
- package/src/write/top-text.js +54 -0
- package/src/write/unhighlight.js +11 -0
- package/temp.txt +17 -0
- package/test.js +27 -64
- package/types/index.d.ts +1095 -0
- package/version.js +1 -1
- package/.babelrc +0 -5
- package/.eslintrc +0 -3
- package/.gitmodules +0 -3
- package/abcjs-midi.css +0 -166
- package/build-utils/loadPresets.js +0 -14
- package/build-utils/presets/webpack.analyze.js +0 -6
- package/build-utils/presets/webpack.optimize.js +0 -30
- package/build-utils/webpack.development.js +0 -14
- package/build-utils/webpack.production.js +0 -35
- package/deploy-docs.sh +0 -25
- package/docs/README.md +0 -33
- package/fix-versions.sh +0 -23
- package/mei.js +0 -43
- package/midi.js +0 -62
- package/src/api/abc_tunebook_midi.js +0 -116
- package/src/midi/abc_midi_controls.js +0 -701
- package/src/midi/abc_midi_flattener.js +0 -1119
- package/src/midi/abc_midi_js_preparer.js +0 -243
- package/src/midi/abc_midi_sequencer.js +0 -401
- package/src/midi/abc_midi_ui_generator.js +0 -86
- package/src/plugin/abc_plugin_midi.js +0 -220
- package/src/synth/images/loop.svg +0 -61
- package/src/synth/images/pause.svg +0 -6
- package/src/synth/images/play.svg +0 -5
- package/src/transform/abc2abc_write.js +0 -395
- package/static-wrappers/basic.js +0 -2
- package/static-wrappers/midi.js +0 -2
- package/static-wrappers/plugin-midi.js +0 -6
- package/static-wrappers/plugin.js +0 -6
- package/webpack.config.js +0 -29
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// abc_midi_ui_generator.js: Used by the editor to automatically generate the correct midi elements.
|
|
2
|
-
// Copyright (C) 2010-2020 Gregory Dyke (gregdyke at gmail dot com) and Paul Rosen
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
6
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
7
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
//
|
|
9
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
//
|
|
11
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
12
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
14
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
|
-
|
|
17
|
-
var midi = require('./abc_midi_controls');
|
|
18
|
-
var midiCreate = require('./abc_midi_create');
|
|
19
|
-
var abcMidiUiGenerator;
|
|
20
|
-
|
|
21
|
-
(function () {
|
|
22
|
-
"use strict";
|
|
23
|
-
|
|
24
|
-
abcMidiUiGenerator = function(tunes, abcjsParams, downloadMidiEl, inlineMidiEl, engravingEl) {
|
|
25
|
-
var downloadMidiHtml = "";
|
|
26
|
-
var inlineMidiHtml = "";
|
|
27
|
-
for (var i = 0; i < tunes.length; i++) {
|
|
28
|
-
var midiInst = midiCreate(tunes[i], abcjsParams);
|
|
29
|
-
|
|
30
|
-
var stopOld = !inlineMidiEl || inlineMidiEl.innerHTML.indexOf("abcjs-midi-current") >= 0;
|
|
31
|
-
|
|
32
|
-
if (abcjsParams.generateInline && abcjsParams.generateDownload) {
|
|
33
|
-
downloadMidiHtml += midi.generateMidiDownloadLink(tunes[i], abcjsParams, midiInst.download, i);
|
|
34
|
-
inlineMidiHtml += midi.generateMidiControls(tunes[i], abcjsParams, midiInst.inline, i, stopOld);
|
|
35
|
-
} else if (abcjsParams.generateInline)
|
|
36
|
-
inlineMidiHtml += midi.generateMidiControls(tunes[i], abcjsParams, midiInst, i);
|
|
37
|
-
else
|
|
38
|
-
downloadMidiHtml += midi.generateMidiDownloadLink(tunes[i], abcjsParams, midiInst, i, stopOld);
|
|
39
|
-
}
|
|
40
|
-
if (abcjsParams.generateDownload) {
|
|
41
|
-
if (downloadMidiEl)
|
|
42
|
-
downloadMidiEl.innerHTML = downloadMidiHtml;
|
|
43
|
-
else
|
|
44
|
-
engravingEl.innerHTML += downloadMidiHtml;
|
|
45
|
-
}
|
|
46
|
-
var find = function (element, cls) {
|
|
47
|
-
var els = element.getElementsByClassName(cls);
|
|
48
|
-
if (els.length === 0)
|
|
49
|
-
return null;
|
|
50
|
-
return els[0];
|
|
51
|
-
};
|
|
52
|
-
if (abcjsParams.generateInline) {
|
|
53
|
-
var inlineDiv;
|
|
54
|
-
if (inlineMidiEl) {
|
|
55
|
-
inlineMidiEl.innerHTML = inlineMidiHtml;
|
|
56
|
-
inlineDiv = inlineMidiEl;
|
|
57
|
-
} else {
|
|
58
|
-
engravingEl.innerHTML += inlineMidiHtml;
|
|
59
|
-
inlineDiv = engravingEl;
|
|
60
|
-
}
|
|
61
|
-
midi.attachListeners(inlineMidiEl);
|
|
62
|
-
|
|
63
|
-
if (abcjsParams.animate || abcjsParams.midiListener) {
|
|
64
|
-
for (i = 0; i < tunes.length; i++) {
|
|
65
|
-
var parent = find(inlineDiv, "abcjs-midi-" + i);
|
|
66
|
-
parent.abcjsTune = tunes[i];
|
|
67
|
-
parent.abcjsListener = abcjsParams.midiListener;
|
|
68
|
-
parent.abcjsQpm = abcjsParams.qpm;
|
|
69
|
-
parent.abcjsContext = abcjsParams.context;
|
|
70
|
-
if (abcjsParams.animate) {
|
|
71
|
-
var drumIntro = abcjsParams.drumIntro ? abcjsParams.drumIntro : 0;
|
|
72
|
-
parent.abcjsAnimate = abcjsParams.animate.listener;
|
|
73
|
-
parent.abcjsTune.setTiming(abcjsParams.qpm, drumIntro);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
window.addEventListener("generateMidi", function (e) {
|
|
81
|
-
var options = e.detail;
|
|
82
|
-
abcMidiUiGenerator(options.tunes, options.abcjsParams, options.downloadMidiEl, options.inlineMidiEl, options.engravingEl);
|
|
83
|
-
});
|
|
84
|
-
})();
|
|
85
|
-
|
|
86
|
-
module.exports = abcMidiUiGenerator;
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
// abc_plugin_midi.js: Find everything which looks like abc and convert it
|
|
2
|
-
|
|
3
|
-
// Copyright (C) 2010-2020 Gregory Dyke (gregdyke at gmail dot com)
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
6
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
7
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
8
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
//
|
|
12
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
13
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
14
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
15
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
|
-
|
|
18
|
-
/*global abcjs_is_user_script, abcjs_plugin_autostart */
|
|
19
|
-
|
|
20
|
-
var renderAbc = require('../api/abc_tunebook_svg');
|
|
21
|
-
var renderMidi = require('../api/abc_tunebook_midi');
|
|
22
|
-
|
|
23
|
-
var Plugin = function() {
|
|
24
|
-
"use strict";
|
|
25
|
-
var is_user_script = false;
|
|
26
|
-
try {
|
|
27
|
-
is_user_script = abcjs_is_user_script;
|
|
28
|
-
} catch (ex) {
|
|
29
|
-
}
|
|
30
|
-
this.show_midi = true;
|
|
31
|
-
this.hide_abc = false;
|
|
32
|
-
this.render_before = false;
|
|
33
|
-
this.midi_options = {};
|
|
34
|
-
//this.parse_options = {};
|
|
35
|
-
this.render_options = {};
|
|
36
|
-
this.render_classname = "abcrendered";
|
|
37
|
-
this.text_classname = "abctext";
|
|
38
|
-
this.auto_render_threshold = 20;
|
|
39
|
-
this.show_text = "show score";
|
|
40
|
-
//this.hide_text = "hide score for: ";
|
|
41
|
-
this.debug = false;
|
|
42
|
-
};
|
|
43
|
-
var plugin = new Plugin();
|
|
44
|
-
|
|
45
|
-
plugin.start = function() {
|
|
46
|
-
var body = window.document.body;
|
|
47
|
-
this.errors="";
|
|
48
|
-
var elems = this.getABCContainingElements(body);
|
|
49
|
-
if (elems.length === 0) return;
|
|
50
|
-
if (this.debug) {
|
|
51
|
-
for (var i = 0; i < elems.length; i++) {
|
|
52
|
-
var str = "Possible ABC found (" + (i+1) + " of " + elems.length + "):\n\n" + elems[i].innerText;
|
|
53
|
-
alert(str);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
var divs = elems.map(this.convertToDivs, this)
|
|
57
|
-
.reduce(function (a, b) {
|
|
58
|
-
return a.concat(b);
|
|
59
|
-
});
|
|
60
|
-
this.auto_render = (divs.length <= this.auto_render_threshold);
|
|
61
|
-
divs.forEach(function (elem) {
|
|
62
|
-
this.render(elem, elem.abctext_);
|
|
63
|
-
}, this);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// returns an array of the descendants (including self) of elem which have a text node which matches "X:"
|
|
67
|
-
plugin.getABCContainingElements = function(elem) {
|
|
68
|
-
var results = [];
|
|
69
|
-
var includeself = false; // whether self is already included (no need to include it again)
|
|
70
|
-
// TODO maybe look to see whether it's even worth it by using textContent ?
|
|
71
|
-
|
|
72
|
-
var child;
|
|
73
|
-
for (var i = 0, ii = elem.childNodes.length; i < ii; ++i) {
|
|
74
|
-
child = elem.childNodes[i];
|
|
75
|
-
if (child.nodeType === 3 && !includeself) {
|
|
76
|
-
if (child.nodeValue.match(/^\s*X:/m)) {
|
|
77
|
-
if (child.parentNode.tagName !== 'TEXTAREA') {
|
|
78
|
-
results.push(elem);
|
|
79
|
-
includeself = true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
} else if (child.nodeType === 1 && child.tagName !== 'TEXTAREA') {
|
|
83
|
-
results = results.concat(this.getABCContainingElements(child));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return results;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// in this element there are one or more pieces of abc
|
|
91
|
-
// (and it is not in a subelem)
|
|
92
|
-
// for each abc piece, we surround it with a div, store the abctext in the
|
|
93
|
-
// div's data("abctext") and return an array
|
|
94
|
-
plugin.convertToDivs = function (elem) {
|
|
95
|
-
var abctext = "";
|
|
96
|
-
var abcdiv = null;
|
|
97
|
-
var inabc = false;
|
|
98
|
-
var brcount = 0;
|
|
99
|
-
var results = [];
|
|
100
|
-
var node;
|
|
101
|
-
var childNodes = Array.prototype.slice.call(elem.childNodes);
|
|
102
|
-
for (var i = 0, ii = childNodes.length; i < ii; ++i) {
|
|
103
|
-
node = childNodes[i];
|
|
104
|
-
if (node.nodeType===3 && !node.nodeValue.match(/^\s*$/)) {
|
|
105
|
-
brcount=0;
|
|
106
|
-
var text = node.nodeValue;
|
|
107
|
-
if (text.match(/^\s*X:/m)) {
|
|
108
|
-
inabc=true;
|
|
109
|
-
abctext="";
|
|
110
|
-
abcdiv = document.createElement("DIV");
|
|
111
|
-
abcdiv.className = this.text_classname;
|
|
112
|
-
|
|
113
|
-
node.parentElement.insertBefore(abcdiv, node);
|
|
114
|
-
|
|
115
|
-
if (this.hide_abc) {
|
|
116
|
-
abcdiv.style.display = 'none';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (inabc) {
|
|
120
|
-
abctext += text.replace(/^\n+/,"");
|
|
121
|
-
abcdiv.appendChild(node)
|
|
122
|
-
}
|
|
123
|
-
} else if (inabc && node.tagName === 'BR') {
|
|
124
|
-
abctext += "\n";
|
|
125
|
-
abcdiv.appendChild(node)
|
|
126
|
-
brcount++;
|
|
127
|
-
} else if (inabc && node.nodeType === 1) {
|
|
128
|
-
abctext += "\n";
|
|
129
|
-
abcdiv.appendChild(node)
|
|
130
|
-
// just swallow this.
|
|
131
|
-
} else if (inabc) { // second br or whitespace textnode
|
|
132
|
-
inabc = false;
|
|
133
|
-
brcount=0;
|
|
134
|
-
abctext = abctext.replace(/\n+/,"\n"); // get rid of extra blank lines
|
|
135
|
-
abcdiv.abctext_ = abctext;
|
|
136
|
-
|
|
137
|
-
results.push(abcdiv);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (inabc) {
|
|
141
|
-
abctext = abctext.replace(/\n+$/,"\n").replace(/^\n+/,"\n"); // get rid of extra blank lines
|
|
142
|
-
abcdiv.abctext_ = abctext;
|
|
143
|
-
results.push(abcdiv);
|
|
144
|
-
}
|
|
145
|
-
return results;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
plugin.render = function (contextnode, abcstring) {
|
|
149
|
-
var abcWrapper = document.createElement('DIV');
|
|
150
|
-
if (this.render_before) {
|
|
151
|
-
contextnode.parentElement.insertBefore(abcWrapper, contextnode);
|
|
152
|
-
} else {
|
|
153
|
-
if (contextnode.nextSibling) {
|
|
154
|
-
contextnode.parentElement.insertBefore(abcWrapper, contextnode.nextSibling);
|
|
155
|
-
} else {
|
|
156
|
-
contextnode.parentElement.appendChild(abcWrapper);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
var self = this;
|
|
160
|
-
try {
|
|
161
|
-
if (this.debug) {
|
|
162
|
-
alert("About to render:\n\n" + abcstring);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
var doPrint = function() {
|
|
166
|
-
var abcDiv = document.createElement('DIV');
|
|
167
|
-
abcDiv.className = self.render_classname;
|
|
168
|
-
abcWrapper.appendChild(abcDiv);
|
|
169
|
-
renderAbc(abcDiv, abcstring, self.render_options);
|
|
170
|
-
if (self.show_midi) {
|
|
171
|
-
var midiDiv = document.createElement('DIV');
|
|
172
|
-
abcWrapper.appendChild(midiDiv);
|
|
173
|
-
renderMidi(midiDiv, abcstring, self.render_options);
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (this.auto_render) {
|
|
179
|
-
doPrint();
|
|
180
|
-
} else {
|
|
181
|
-
var showtext = document.createElement('A');
|
|
182
|
-
showtext.className = 'abcshow';
|
|
183
|
-
showtext.href = '#';
|
|
184
|
-
showtext.innerHTML = this.show_text;
|
|
185
|
-
showtext.onclick = function () {
|
|
186
|
-
doPrint();
|
|
187
|
-
showtext.remove();
|
|
188
|
-
return false;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
abcdiv.parentElement.insertBefore(showtext, abcdiv);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
} catch (e) {
|
|
195
|
-
this.errors += e;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// There may be a variable defined which controls whether to automatically run the script. If it isn't
|
|
201
|
-
// there then it will throw an exception, so we'll catch it here.
|
|
202
|
-
var autostart = true;
|
|
203
|
-
if (typeof abcjs_plugin_autostart !== 'undefined') {
|
|
204
|
-
autostart = abcjs_plugin_autostart;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (autostart &&
|
|
208
|
-
typeof window !== 'undefined' &&
|
|
209
|
-
typeof (window.document) !== 'undefined') {
|
|
210
|
-
|
|
211
|
-
if (window.document.readyState !== 'loading') {
|
|
212
|
-
plugin.start();
|
|
213
|
-
} else {
|
|
214
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
215
|
-
plugin.start();
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
module.exports = plugin;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 700 700" preserveAspectRatio="xMidYMid meet">
|
|
2
|
-
<g transform="translate(0,700) scale(0.1,-0.1)" >
|
|
3
|
-
<path d="M3111 6981 c-20 -37 -90 -55 -364 -96 -120 -18 -190 -33 -244 -55
|
|
4
|
-
-42 -17 -124 -42 -182 -56 -78 -18 -119 -34 -157 -60 -28 -19 -86 -46 -128
|
|
5
|
-
-60 -43 -13 -107 -42 -144 -64 -37 -23 -84 -46 -106 -52 -21 -7 -56 -29 -79
|
|
6
|
-
-50 -22 -22 -61 -50 -86 -63 -26 -13 -67 -40 -91 -60 -24 -20 -65 -47 -90 -60
|
|
7
|
-
-25 -13 -53 -31 -61 -41 -8 -9 -32 -30 -54 -46 -75 -54 -486 -460 -512 -507
|
|
8
|
-
-15 -25 -48 -69 -75 -98 -26 -28 -48 -57 -48 -63 0 -6 -18 -29 -39 -53 -21
|
|
9
|
-
-23 -56 -71 -77 -107 -20 -36 -50 -80 -65 -97 -16 -18 -33 -52 -40 -75 -12
|
|
10
|
-
-47 -47 -115 -84 -166 -13 -18 -30 -56 -38 -83 -8 -27 -34 -80 -56 -118 -33
|
|
11
|
-
-53 -46 -91 -62 -167 -12 -63 -34 -127 -59 -179 -42 -84 -60 -166 -60 -270 0
|
|
12
|
-
-90 26 -122 125 -154 54 -17 96 -19 430 -20 305 -1 381 2 430 14 82 22 140 51
|
|
13
|
-
153 78 6 12 22 47 37 77 14 30 38 77 54 103 15 27 34 73 40 103 7 30 28 78 48
|
|
14
|
-
107 19 28 44 74 55 101 10 28 34 67 53 87 18 20 49 61 68 90 19 30 44 63 57
|
|
15
|
-
74 13 11 36 40 52 65 59 94 232 270 306 313 20 11 57 37 82 58 25 20 70 52
|
|
16
|
-
100 72 30 19 66 47 79 61 13 14 49 35 80 46 30 12 80 37 111 56 31 19 95 45
|
|
17
|
-
143 58 48 12 110 37 139 55 63 40 127 55 323 76 83 9 208 28 279 41 156 29
|
|
18
|
-
165 29 330 4 453 -71 514 -84 606 -130 31 -16 83 -36 116 -45 32 -9 84 -34
|
|
19
|
-
115 -56 31 -21 82 -48 113 -60 32 -11 72 -33 89 -48 18 -16 59 -45 92 -65 33
|
|
20
|
-
-21 74 -51 90 -66 17 -15 49 -40 73 -54 52 -32 65 -61 50 -113 -8 -31 -61 -90
|
|
21
|
-
-277 -308 -300 -303 -361 -382 -369 -481 -2 -29 0 -66 6 -81 13 -40 88 -138
|
|
22
|
-
115 -151 12 -6 54 -26 92 -44 l70 -33 945 -2 c520 -1 975 2 1012 7 64 8 191
|
|
23
|
-
50 231 76 11 7 33 34 50 60 22 34 42 51 65 58 l32 9 0 1101 0 1102 -32 9 c-21
|
|
24
|
-
7 -44 26 -64 55 -60 84 -77 97 -140 110 -44 9 -76 10 -127 2 -59 -9 -77 -17
|
|
25
|
-
-134 -62 -37 -28 -172 -155 -301 -281 -129 -127 -249 -237 -267 -245 -25 -10
|
|
26
|
-
-41 -11 -71 -2 -58 15 -112 45 -124 69 -6 11 -35 35 -64 54 -28 18 -58 41 -66
|
|
27
|
-
50 -8 9 -41 35 -75 58 -33 22 -77 56 -99 75 -21 18 -64 46 -95 61 -31 14 -73
|
|
28
|
-
39 -93 55 -20 15 -70 40 -110 55 -40 15 -97 44 -127 64 -29 21 -78 44 -107 53
|
|
29
|
-
-30 8 -77 31 -105 51 -42 28 -73 39 -173 60 -68 14 -154 39 -196 58 -95 43
|
|
30
|
-
-131 51 -343 76 -209 24 -242 32 -279 70 l-30 29 -328 0 c-312 0 -330 -1 -339
|
|
31
|
-
-19z"></path>
|
|
32
|
-
<path d="M254 2875 c-89 -16 -107 -26 -145 -78 -32 -44 -62 -66 -91 -67 -17 0
|
|
33
|
-
-18 -61 -18 -1140 l0 -1140 24 0 c16 0 41 -17 72 -50 40 -42 61 -55 117 -72
|
|
34
|
-
l69 -21 82 23 c44 12 96 30 114 39 18 9 148 132 290 272 141 141 267 261 279
|
|
35
|
-
268 51 26 86 14 176 -61 32 -26 62 -48 66 -48 5 0 36 -25 70 -55 34 -30 74
|
|
36
|
-
-61 89 -69 15 -8 37 -28 50 -45 12 -17 50 -45 84 -62 34 -17 78 -44 98 -60 19
|
|
37
|
-
-16 61 -37 93 -48 32 -11 81 -37 107 -56 27 -20 76 -45 109 -56 33 -12 75 -31
|
|
38
|
-
93 -44 62 -45 93 -58 191 -82 54 -12 130 -37 168 -54 68 -29 180 -58 226 -59
|
|
39
|
-
62 0 183 -64 183 -96 0 -12 88 -14 639 -14 l639 0 12 30 c18 44 76 66 233 89
|
|
40
|
-
89 14 160 30 200 47 34 15 106 42 159 60 54 18 112 44 130 57 47 35 85 52 146
|
|
41
|
-
67 29 7 76 28 105 48 29 20 77 48 107 63 30 15 66 39 80 54 14 15 50 40 81 56
|
|
42
|
-
31 15 78 46 104 69 26 22 61 46 79 54 17 7 43 26 56 42 14 16 41 41 60 56 64
|
|
43
|
-
48 380 362 408 405 15 23 40 51 55 63 15 12 36 38 46 58 11 21 37 57 58 82 22
|
|
44
|
-
25 49 62 62 83 13 20 38 56 57 78 19 23 50 74 69 113 19 39 46 86 59 104 14
|
|
45
|
-
18 34 62 46 98 12 36 32 77 45 92 31 38 60 97 80 167 9 33 26 76 37 95 29 50
|
|
46
|
-
47 103 68 206 10 52 32 117 51 155 29 56 33 74 34 140 0 94 -10 108 -101 138
|
|
47
|
-
-61 20 -83 21 -463 21 -226 0 -421 -4 -451 -10 -63 -12 -86 -30 -110 -85 -10
|
|
48
|
-
-22 -33 -63 -52 -92 -21 -31 -42 -80 -53 -123 -11 -44 -32 -93 -56 -128 -20
|
|
49
|
-
-32 -47 -83 -59 -115 -12 -32 -37 -77 -56 -100 -19 -23 -50 -65 -69 -94 -19
|
|
50
|
-
-29 -44 -57 -54 -63 -11 -5 -29 -27 -42 -47 -52 -85 -234 -277 -300 -315 -25
|
|
51
|
-
-15 -53 -38 -62 -51 -9 -14 -42 -39 -74 -57 -32 -18 -75 -48 -95 -66 -21 -18
|
|
52
|
-
-59 -44 -85 -58 -26 -13 -72 -40 -100 -59 -35 -24 -78 -41 -128 -52 -47 -11
|
|
53
|
-
-99 -31 -139 -56 -69 -42 -94 -49 -391 -110 -245 -51 -425 -66 -595 -50 -168
|
|
54
|
-
16 -230 27 -330 61 -47 16 -123 35 -170 44 -98 17 -123 25 -172 58 -20 14 -71
|
|
55
|
-
37 -114 53 -44 15 -95 40 -115 56 -20 16 -70 42 -110 59 -40 16 -88 45 -108
|
|
56
|
-
63 -20 19 -55 46 -78 61 -24 14 -49 35 -55 47 -7 11 -34 33 -60 49 -50 31 -65
|
|
57
|
-
61 -53 102 4 13 130 147 281 298 236 238 277 283 299 335 15 32 35 71 46 86
|
|
58
|
-
12 18 19 44 19 76 0 42 -8 63 -53 138 -92 151 11 139 -1207 141 -798 2 -1030
|
|
59
|
-
0 -1086 -11z"></path>
|
|
60
|
-
</g>
|
|
61
|
-
</svg>
|