You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
412 KiB
3 lines
412 KiB
4 weeks ago
|
/*! abcjs_plugin v6.4.3 Copyright © 2009-2024 Paul Rosen and Gregory Dyke (https://abcjs.net) */
|
||
|
/*! For license information please see abcjs_plugin.LICENSE */
|
||
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.abcjs=t():e.ABCJS=t()}(this,(function(){return e={7001:function(e,t,r){"use strict";var a=r(1592).TuneBook,i=r(8905),n=r(5253),s=new function(){var e=!1;try{e=abcjs_is_user_script}catch(e){}this.show_midi=!e,this.hide_abc=!1,this.render_before=!1,this.midi_options={},this.render_options={},this.render_classname="abcrendered",this.text_classname="abctext",this.auto_render_threshold=20,this.show_text="show score for: ",this.debug=!1};s.start=function(){var e=window.document.body;this.errors="";var t=this.getABCContainingElements(e);if(0!==t.length){if(this.debug)for(var r=0;r<t.length;r++){var a="Possible ABC found ("+(r+1)+" of "+t.length+"):\n\n"+t[r].innerText;alert(a)}var i=t.map(this.convertToDivs,this).reduce((function(e,t){return e.concat(t)}));this.auto_render=i.length<=this.auto_render_threshold,i.forEach((function(e){this.render(e,e.abctext_)}),this)}},s.getABCContainingElements=function(e){for(var t,r=[],a=!1,i=0,n=e.childNodes.length;i<n;++i)3!==(t=e.childNodes[i]).nodeType||a?1===t.nodeType&&"TEXTAREA"!==t.tagName&&(r=r.concat(this.getABCContainingElements(t))):t.nodeValue.match(/^\s*X:/m)&&"TEXTAREA"!==t.parentNode.tagName&&(r.push(e),a=!0);return r},s.convertToDivs=function(e){for(var t,r="",a=null,i=!1,n=[],s=Array.prototype.slice.call(e.childNodes),o=0,c=s.length;o<c;++o)if(3!==(t=s[o]).nodeType||t.nodeValue.match(/^\s*$/))i&&"BR"===t.tagName||i&&1===t.nodeType?(r+="\n",a.appendChild(t)):i&&(i=!1,r=r.replace(/\n+/,"\n"),a.abctext_=r,n.push(a));else{var l=t.nodeValue;l.match(/^\s*X:/m)&&(i=!0,r="",(a=document.createElement("DIV")).className=this.text_classname,t.parentElement.insertBefore(a,t),this.hide_abc&&(a.style.display="none")),i&&(r+=l.replace(/^\n+/,""),a.appendChild(t))}return i&&(r=r.replace(/\n+$/,"\n").replace(/^\n+/,"\n"),a.abctext_=r,n.push(a)),n},s.render=function(e,t){var r=document.createElement("DIV");r.className=this.render_classname,this.render_before?e.parentElement.insertBefore(r,e):e.nextSibling?e.parentElement.insertBefore(r,e.nextSibling):e.parentElement.appendChild(r);var s=this;try{this.debug&&alert("About to render:\n\n"+t);var o=new a(t),c=new i;c.parse(o.tunes[0].abc);var l=c.getTune(),h=function(){try{var t=new n(r,s.render_options);t.engraveABC(l)}catch(a){r.remove(),(r=document.createElement("DIV")).className=s.render_classname,(t=new n(r)).engraveABC(l),s.render_before?e.parentElement.insertBefore(r,e):e.nextSibling?e.parentElement.insertBefore(r,e.nextSibling):e.parentElement.appendChild(r)}},d=document.createElement("A");d.className="abcshow",d.href="#",d.innerHTML=this.show_text+(l.metaText.title||"untitled"),this.auto_render?h():(d.onclick=function(){return h(),d.remove(),!1},r.parentElement.insertBefore(d,r))}catch(e){this.errors+=e}};var o=!0;"undefined"!=typeof abcjs_plugin_autostart&&(o=abcjs_plugin_autostart),o&&"undefined"!=typeof window&&void 0!==window.document&&("loading"!==window.document.readyState?s.start():document.addEventListener("DOMContentLoaded",(function(){s.start()})));var c={plugin:s};e.exports=c},1592:function(e,t,r){function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var i=r(8905),n=r(9565),s=r(2426),o={};!function(){"use strict";o.numberOfTunes=function(e){var t=e.split("\nX:").length;return 0===t&&(t=1),t};var e=o.TuneBook=function(e){var t=n(e);this.header=t.header,this.tunes=t.tunes};e.prototype.getTuneById=function(e){for(var t=0;t<this.tunes.length;t++)if(this.tunes[t].id===""+e)return this.tunes[t];return null},e.prototype.getTuneByTitle=function(e){for(var t=0;t<this.tunes.length;t++)if(this.tunes[t].title===e)return this.tunes[t];return null},o.parseOnly=function(e,t){for(var r=o.numberOfTunes(e),a=[],i=0;i<r;i++)a.push(1);return o.renderEngine((function(){}),a,e,t)},o.renderEngine=function(t,r,n,o
|