UNPKG

doremi-script

Version:

Letter music notation processor

1 lines 19.3 kB
"use strict";window.StackExchange={};if(top!=self){top.location.replace(document.location);alert("For security reasons, framing is not allowed; click OK to remove the frames.")}StackExchange.init=(function(){var d=function(f){if(!window.jQuery){if(document.readyState!="complete"){setTimeout(function(){d(f)},1000);return}var e=document.createElement("div");e.id="noscript-padding";var g=document.createElement("div");g.id="noscript-warning";g.innerHTML=f+" requires external JavaScript from another domain, which is blocked or failed to load.";document.body.insertBefore(e,document.body.firstChild);document.body.appendChild(g)}};var c=function(){$(document).keyup(function(e){if(e.which==27){$("#lightbox, .error-notification, .popup, .share-tip, .esc-remove").fadeOutAndRemove();$(".esc-hide").fadeOut();if(window.genuwine&&genuwine.isVisible()){genuwine.click()}if(window.profileLink){profileLink.hide()}}})};var a=function(){var i=$("#hlinks"),o=$("#search input[name=q]"),p=o.width(),j=p*2.5,k="expand",g=100,n,e=function(q){o.queue(k,q)},l=function(){o.dequeue(k)};var f=false;var h=!("placeholder" in document.createElement("input"));if(h&&!StackExchange.options.isMobile){if(o[0].value==""){o[0].value="search"}o.bind({focus:function(){if(this.value=="search"){this.value=""}}})}o.keydown(function(q){if(f||(q.keyCode<46&&q.keyCode!=8&&q.keyCode!=32)){return true}f=true;clearTimeout(n);o.clearQueue(k);e(function(r){o[0].placeholder="";i.fadeOut(g,r)});e(function(r){o.animate({width:j,"max-width":j},g,r)});e(function(r){if(o.parent().find(".search-prompt").length==0){o.before('<span class="search-prompt">search:</span>')}});if(o.queue(k).length==3){l()}}).focusout(function(){n=setTimeout(function(){e(function(q){o.parent().find(".search-prompt").remove();q()});e(function(q){o.animate({width:p,"max-width":p},g,q)});e(function(q){if(h&&o[0].value==""){o[0].value="search"}o[0].placeholder="search";i.fadeIn(g,q)});if(o.queue(k).length==3){l()}f=false},200)});$("#search").keydown(function(q){if(q.which==13&&q.ctrlKey&&o.val()){window.open("/search?q="+encodeURIComponent(o.val()),"_newtab");return false}})};return function(e){StackExchange.options=e;var f=e.serverTime-(new Date()).getTime()/1000;d(e.site.name);$.ajaxSetup({cache:false});StackExchange.init.createJqueryExtensions();$(function(){c();a();StackExchange.using(StackExchange.options.user.isAnonymous?"anonymous":"loggedIn",function(){StackExchange.initialized.resolve()},true);StackExchange.ready(function(){genuwine.init(e.user.accountId||null,e.user.inboxUnviewedCount);if(e.user.messages){StackExchange.notify.showMessages(e.user.messages,e.isMobile)}if(!e.site.globalAuthDisabled){if(!e.site.isChildMeta&&e.user.isAnonymous){gauth.checkStackAuth(e.stackAuthUrl)}gauth.informStackAuth(e.stackAuthUrl)}if(e.user.isAnonymous){StackExchange.notify.showFirstTime(e.site.description)}else{profileLink.init(e.user.gravatar,e.isMobile,e.user.profileUrl+"?tab=activity",f)}if(e.enableUserHovercards){StackExchange.usermenu.init()}if(StackExchange.tagPreferences){StackExchange.tagPreferences.init()}else{StackExchange.tagmenu.init()}})})}})();StackExchange.debug={log:function(a){},init:function(){this.log=function(a){$(function(){var c=$("#debug-messages");if(!c.length){c=$("<div id='debug-messages' style='text-align:left;position:fixed;top:50px;left:50px;z-index:1000;background:white;border:2px solid black;width:300px;padding:10px;' />").append($("<span style='cursor:pointer;color:#999'>(close debug messages)</span>").click(function(){$("#debug-messages").remove()})).appendTo("body")}$("<div style='margin-top:10px' />").text(a).appendTo(c)})}}};StackExchange.initialized=$.Deferred();StackExchange.ready=function(a){StackExchange.initialized.done(a)};StackExchange.using=(function(){var i={prettify:"prettify-full.js",pseudoModerator:"moderator.js",anonymous:"full-anon.js",loggedIn:"full.js",inlineEditing:"full.js",editor:"wmd.js",autocomplete:"third-party/jquery.autocomplete.min.js",tagAutocomplete:"tageditor.js",tagEditor:"tageditornew.js",mobile:"mobile.js",help:"help.js",inlineTagEditing:"inline-tag-editing.js",mathjaxEditing:"mathjax-editing.js",revisions:"revisions.js"},o={},d={},e,k={};var f=function(q,p){return function(r){var s=q[r];if(!s){s=q[r]=p(r)}return s}};var n=function(){if(!e){var p=$("script[src*='/stub.js']:first");if(p.length==0){StackExchange.debug.log("couldn't figure out location of stub.js");e="/content/js/"}else{e=p.attr("src").replace(/\/stub\.js.*$/,"/")}}return e};var h=function(q){var p=k["js/"+q];if(!p){StackExchange.debug.log("no cache breaker for "+q);return""}return"?v="+p};var a=function(p){var q=$.Deferred(),r=document.createElement("script");r.async="async";r.type="text/javascript";r.src=n()+p+h(p);r.onload=r.onreadystatechange=function(t,s){if(!r.readyState||/loaded|complete/.test(r.readyState)){if(s){q.reject()}else{q.resolve()}}};r.onerror=function(){q.reject()};$("head")[0].appendChild(r);return q.promise()};var g=function(q){var p=i[q];if(!p){return $.Deferred().reject().promise()}return j(p)};var j=f(d,a);var c=f(o,function(t){var q=$.Deferred(),s=StackExchange[t],r=3;function p(){s=StackExchange[t];if(!s){if(r>0){r--;StackExchange.debug.log("retrying "+t);setTimeout(p,20);return}else{StackExchange.debug.log("object "+t+" not available although file was loaded");q.reject();return}}q.resolve()}if(s){q.resolve()}else{g(t).done(p).fail(q.reject)}return q.promise()});var l=function(s,p,r){var q=c(s);if(!r){q=$.when(q,StackExchange.initialized)}q.done(function(){p()}).fail(function(){StackExchange.debug.log("failed to provide object "+s)})};l.setCacheBreakers=function(p){k=p};return l})();String.prototype.format=function(){var a=this.toString();if(!arguments.length){return a}var d=typeof arguments[0]=="string"?arguments:arguments[0];for(var c in d){a=a.replace(new RegExp("\\{"+c+"\\}","gi"),d[c])}return a};String.prototype.truncate=function(a,d){var c=this.toString();if(a&&c.length>a){c=c.substr(0,a)+d}return c};StackExchange.init.createJqueryExtensions=function(){var a=StackExchange.helpers;$.fn.extend({fadeOutAndRemove:function(c){return this.each(function(){var d=$(this);d.fadeOut("fast",function(){d.trigger("removing").remove()})})},charCounter:function(c){return this.each(function(){var d=c.target?$(c.target):$(this).parents("form").find("span.text-counter");var e=this;var f=function(){var j=c.min;var l=c.max;var k=c.setIsValid||function(){};var h=e.value?e.value.length:0;var i=h>l*0.8?"supernova":h>l*0.6?"hot":h>l*0.4?"warm":"cool";var g="";if(h==0){g="enter at least "+j+" characters";k(false)}else{if(h<j){g=(j-h)+" more to go...";k(false)}else{g=(l-h)+" character"+(l-h!=1?"s":"")+" left";k(h<=l)}}d.text(g);if(!d.hasClass(i)){d.removeClass("supernova hot warm cool").addClass(i)}};$(this).bind("blur focus keyup paste",a.DelayedReaction(f,100,{sliding:true}).trigger)})},selectRange:function(d,c){return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(d,c)}else{if(this.createTextRange){var e=this.createTextRange();e.collapse(true);e.moveEnd("character",c);e.moveStart("character",d);e.select()}}})},addSpinner:function(c){return this.each(function(){a.addSpinner(this,c)})},addSpinnerAfter:function(c){return this.each(function(){$(this).after(a.getSpinnerImg(c))})},removeSpinner:function(){return this.each(function(){$(this).find("img.ajax-loader").remove()})},showErrorPopup:function(e,d,c){return this.each(function(){a.showErrorPopup(this,e,d,c)})},center:function(){this.css("position","absolute");this.css("top",($(window).height()-this.height())/2+$(window).scrollTop()+"px");this.css("left",($(window).width()-this.width())/2+$(window).scrollLeft()+"px");return this},helpOverlay:function(){a.bindHelpOverlayEvents(this);return this},hideHelpOverlay:function(){a.hideHelpOverlay(this);return this},enable:function(){if(arguments.length==0||arguments[0]){this.removeAttr("disabled").css("cursor","pointer")}else{this.attr("disabled","disabled").css("cursor","default")}return this},disable:function(){return this.enable(false)},loadPopup:function(d){var c=this;c.addSpinnerAfter({padding:"0 3px"});$.ajax({type:"GET",url:d.url,dataType:"html",success:function(f){var h=$(f);h.find(".popup-actions-cancel, .popup-close a").click(function(){h.fadeOutAndRemove()});h.find("input:radio[disabled=disabled] + label.action-label").addClass("action-disabled");if(d.hideDescriptions){h.find("ul.action-list > li:not(.action-selected) .action-desc").hide()}var g=h.find("input:radio:not(.action-subform input)");g.closest("li").bind("hide-action",function(){var j=$(this);var k=".action-subform"+(d.hideDescriptions?", .action-desc":"");j.removeClass("action-selected").find(k).slideUp("fast")}).bind("show-action",function(){var j=$(this);if(j.hasClass("action-selected")){return}j.siblings(".action-selected").trigger("hide-action");j.addClass("action-selected").find(".action-subform").slideDown("fast",function(){if(d.subformShow){d.subformShow($(this))}if(d.subformFocusInput){var k=$(this).find("input[type=text], textarea").not(".actual-edit-overlay").eq(0);if(k.length){k.focus()}}});if(d.hideDescriptions){j.find(".action-desc").slideDown("fast")}if(d.actionSelected){d.actionSelected(j)}h.find(".popup-submit").enable()});g.click(function(){$(this).closest("li").trigger("show-action")});h.appendTo(c.parent());if(d.loaded){d.loaded(h)}var i=function(){};if(d.subformShow){var e=h.find("li.action-selected .action-subform");if(e.length>0){i=function(){e.each(function(){d.subformShow($(this))})}}}if(!(!!d.dontCenter)){h.center().fadeIn("fast",i)}},error:function(){c.parent().showErrorPopup("Unable to load popup - please try again")},complete:a.removeSpinner});return c},normalizeRadioTextareaBehaviour:function(){this.mouseup(function(){var d=$("#"+$(this).closest("label").attr("for"));if(d&&d.length&&d.is(":checked")===false){d.attr("checked",true)}var c=$(this);setTimeout(function(){c.focus()},1)});return this}})};StackExchange.helpers=(function(){var d=function(h){return h.parent().find("span.edit-field-overlay")};var c=["left","right","top","bottom"];function g(h,r,s){for(var k=0;k<s.length;k++){var n=s[k];try{if(/\*/.test(n)){for(var l=0;l<4;l++){var q=n.replace(/\*/g,c[l]);var o=h.css(q);r.css(q,o)}}else{r.css(n,h.css(n))}}catch(p){}}}function e(n,t,j,o){if(!n.is(":visible")){return}var i=$.browser.msie?0:0.4;if(!j()){n.css("opacity",1).css("filter","").removeClass("edit-field-overlayed");return}else{n.css("opacity",i+(o?0.2:0));n.addClass("edit-field-overlayed")}var k=n.prev(".actual-edit-overlay");if(k.length==0){var h=d(n).text(),v=n.width(),r=n.height();k=n.clone().attr("class","actual-edit-overlay").attr("name",null).attr("id",null).attr("disabled","disabled").css({position:"absolute",backgroundColor:"white",color:"black","-webkit-text-fill-color":"black",opacity:1,width:v,height:r});if(k.is("textarea,input")){k.val(h);g(t,k,["line-height"])}else{k.text(h).css("line-height",r+"px").prepend("&nbsp;")}g(t,k,["font-family","font-size","text-align"]);g(n,k,["border-*-style","border-*-color","border-*-width"]);n.css({zIndex:1,position:"relative"});k.insertBefore(n);var u=n.offset().top-k.offset().top;if(u!=0){var s=parseInt(k.css("margin-top"));var l=s+u;if(!n.is("textarea")){l=parseInt(k.prevAll(":visible").eq(0).css("margin-bottom"))+s}k.css("margin-top",l)}var p=n.offset().left-k.offset().left;if(p!=0){var q=parseInt(k.css("margin-left"));k.css("margin-left",q+p)}}}function f(i,h){$(i).find("input[type='submit']").attr("disabled",h?"disabled":"")}var a={genericBindOverlayEvents:function(i,j,h){if(StackExchange.options.isMobile){return}j.bind("keydown contextmenu",function(){a.hideHelpOverlay(i)}).focus(function(){e(i,j,h,true)}).blur(function(){e(i,j,h)}).each(function(){e(i,j,h)})},bindHelpOverlayEvents:function(h){h.each(function(){var i=$(this);a.genericBindOverlayEvents(i,i,function(){return i.val()===""})})},hideHelpOverlay:function(h){h.css("opacity",1);h.css("filter","");h.removeClass("edit-field-overlayed")},onClickDraftSave:function(h){$(h).click(function(){var i=this.href;StackExchange.cardiologist.ensureDraftSaved(function(){window.onbeforeunload=null;window.location.href=i});return false});return true},showErrorPopup:function(l,j,h,k){$(".error-notification").remove();var i=$('<div class="error-notification supernovabg"><h2>'+j+"</h2>"+(h?"":'<span class="error-close">(click on this box to dismiss)</span>')+"</div>");var n=function(){i.fadeOutAndRemove();if(k){k()}};$(l).append(i);i.click(n).fadeIn("fast");setTimeout(n,(h?Math.max(2500,j.length*40):1000*30))},removeErrorPopup:function(){$(".error-notification").fadeOutAndRemove()},addSpinner:function(h,i){$(h).append(a.getSpinnerImg(i))},getSpinnerImg:function(h){var i=$('<img class="ajax-loader" src="/content/img/progress-dots.gif" title="loading..." alt="loading..." />');if(h){i.css(h)}return i},removeSpinner:function(){$("img.ajax-loader").remove()},enableSubmitButton:function(h){f(h,false)},disableSubmitButton:function(h){f(h,true)},loadTicks:function(h){var i;if(h){i=h.find(".edit-block")}else{i=$(".edit-block")}if(i.find("input[name=i1l]").length==0){if(!i.data("loading-ticks")){i.data("loading-ticks",true);$.ajax({url:"/questions/ticks",cache:false,success:function(j){i.append("<input type='hidden' name='i1l' value='"+j+"' />")},complete:function(){i.data("loading-ticks",false)}})}}},showFancyOverlay:function(i){i=i||{};var k=$("#overlay-header"),j=i.message||"",h=$.browser.msie?{background:"#fff",opacity:0}:{};if(i.showClose!==false){j+='<br><a class="close-overlay">close this message</a>'}k.html(j).css(h).animate({opacity:"1",height:"show"},"slow",i.complete).find(".close-overlay").click(function(){k.animate({opacity:"0",height:"hide"},"fast")})},DelayedReaction:function(j,k,i){i=i||{};var n,o,l=i.always;var h=function(){n=null;j.apply(null,o)};return{trigger:function(){o=arguments;if(l){l.apply(null,o)}if(n){if(i.sliding){clearTimeout(n);n=setTimeout(h,k)}else{return}}else{n=setTimeout(h,k)}},cancel:function(){if(n){clearTimeout(n);n=null}}}}};return a})();function prepareEditor(c){var j=c.postfix||"";var l=function(){setTimeout(function(){StackExchange.editor.initIfShown(c)},1)};if(StackExchange.editor){l();return}if(!c.onDemand){StackExchange.using("editor",l);return}var n="bold-button italic-button spacer1 link-button quote-button code-button image-button spacer2 olist-button ulist-button heading-button hr-button spacer3 undo-button redo-button".split(" ");var d=$('<ul id="wmd-button-row'+j+'" class="wmd-button-row" />').appendTo(".wmd-button-bar");var e=0;for(var a=0;a<n.length;a++){var g=n[a];var h=/spacer/.test(g);var f=$("<li id='wmd-"+g+j+"' />").attr("class","wmd-"+(h?"spacer":"button")).css("left",a*25).appendTo(d);$("<span />").css("background-position",(e)+"px -20px").appendTo(f);if(!h){e-=20}}var k=false;$("#wmd-input, #title, #tagnames, #edit-comment, #m-address, #display-name").one("focus click keydown",function(){if(k){return}k=true;var i=function(){d.remove();if(c.autoShowMarkdownHelp){c.immediatelyShowMarkdownHelp=true}l()};d.addSpinner({"float":"right"});StackExchange.using("editor",i)})}StackExchange.switchMobile=function(a,c){$.post("/mobile/"+a,{returnurl:c},function(e,f,d){window.location=e})};jQuery.cookie=function(l,a,d){if(typeof a!="undefined"){d=d||{};if(a===null){a="";d.expires=-1}var c="";if(d.expires&&(typeof d.expires=="number"||d.expires.toUTCString)){var g;if(typeof d.expires=="number"){g=new Date();g.setTime(g.getTime()+(d.expires*24*60*60*1000))}else{g=d.expires}c="; expires="+g.toUTCString()}var h=d.path?"; path="+(d.path):"";var k=d.domain?"; domain="+(d.domain):"";var o=d.secure?"; secure":"";document.cookie=[l,"=",encodeURIComponent(a),c,h,k,o].join("")}else{var n=null;if(document.cookie&&document.cookie!=""){var j=document.cookie.split(";");for(var e=0;e<j.length;e++){var f=jQuery.trim(j[e]);if(f.substring(0,l.length+1)==(l+"=")){n=decodeURIComponent(f.substring(l.length+1));break}}}return n}};jQuery.expr[":"].regex=function(a,h,d){var c=d[3].split(","),e=/^(data|css):/,g={method:c[0].match(e)?c[0].split(":")[0]:"attr",property:c.shift().replace(e,"")},f="ig",i=new RegExp(c.join("").replace(/^\s+|\s+$/g,""),f);return i.test(jQuery(a)[g.method](g.property))};$.extend($.expr[":"],{containsExact:function(d,c,e){return $.trim(d.innerHTML.toLowerCase())===e[3].toLowerCase()},containsExactCase:function(d,c,e){return $.trim(d.innerHTML)===e[3]},containsRegex:function(d,c,f){var e=/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})$/,g=e.exec(f[3]);return RegExp(g[1],g[2]).test($.trim(d.innerHTML))}});$.extend({URLEncode:function(i){var g="";var e=0;i=i.toString();var j=/(^[a-zA-Z0-9_.]*)/;while(e<i.length){var f=j.exec(i.substr(e));if(f!=null&&f.length>1&&f[1]!=""){g+=f[1];e+=f[1].length}else{if(i[e]==" "){g+="+"}else{var k=i.charCodeAt(e);var a=k.toString(16);g+="%"+(a.length<2?"0":"")+a.toUpperCase()}e++}}return g},URLDecode:function(d){var a=d;var f,e;var c=/(%[^%]{2})/;while((m=c.exec(a))!=null&&m.length>1&&m[1]!=""){b=parseInt(m[1].substr(1),16);e=String.fromCharCode(b);a=a.replace(m[1],e)}return a}});(function(a){a.fn.typeWatch=function(c){var f=a.extend({wait:750,callback:function(){},highlight:true,captureLength:2},c);function d(g,h){var i=a(g.el).val();if((i.length>f.captureLength&&i.toUpperCase()!=g.text)||(h&&i.length>f.captureLength)){g.text=i.toUpperCase();g.cb(i)}}function e(i){if(i.type.toUpperCase()=="TEXT"||i.nodeName.toUpperCase()=="TEXTAREA"){var g={timer:null,text:a(i).val().toUpperCase(),cb:f.callback,el:i,wait:f.wait};if(f.highlight){a(i).focus(function(){this.select()})}var h=function(n){var k=g.wait;var l=false;if(n.keyCode==13&&this.type.toUpperCase()=="TEXT"){k=1;l=true}var j=function(){d(g,l)};clearTimeout(g.timer);g.timer=setTimeout(j,k)};a(i).keydown(h)}}return this.each(function(g){e(this)})}})(jQuery);(function(e){e.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){e.fx.step[f]=function(h){if(!h.colorInit){h.start=d(h.elem,f);h.end=c(h.end);h.colorInit=true}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0]),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1]),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2]),255),0)].join(",")+")"}});function c(f){var g;if(f&&f.constructor==Array&&f.length==3){return f}if(g=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(g[1]),parseInt(g[2]),parseInt(g[3])]}if(g=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(g[1])*2.55,parseFloat(g[2])*2.55,parseFloat(g[3])*2.55]}if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16)]}if(g=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(g[1]+g[1],16),parseInt(g[2]+g[2],16),parseInt(g[3]+g[3],16)]}if(g=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[e.trim(f).toLowerCase()]}function d(h,g){var f;do{f=e.curCSS(h,g);if(f!=""&&f!="transparent"||e.nodeName(h,"body")){break}g="backgroundColor"}while(h=h.parentNode);return c(f)}var a={}})(jQuery);