Skip to content

Instantly share code, notes, and snippets.

@inajob
Last active August 30, 2021 12:13
Show Gist options
  • Save inajob/188a81557a04a454fde2fe7eedf30056 to your computer and use it in GitHub Desktop.
Save inajob/188a81557a04a454fde2fe7eedf30056 to your computer and use it in GitHub Desktop.
ChordWikiの和音をICNに変換するブックマークレット).js
javascript:(Array.prototype.slice.bind(document.getElementsByClassName("chord"))().forEach((e)=>{let%20raw=""+e.firstChild.nodeValue;let%20m=raw.match(/^([A-G]m{0,1})([^/]*)/);let%20s="-";if(m){let%20base=m[1];let%20q=m[2];let%20swapped=false;let%20noMap={"C":1,"D":2,"E":3,"F":4,"G":5,"A":6,"B":7};let%20no=noMap[base[0]];let%20isQAvailable=false;if("C,Dm,Em,F,G,Am,Bm".split(",").includes(base)){};if("Cm,D,E,Fm,Gm,A,B".split(",").includes(base)){swapped=true;};if("dim,7,9,M7,sus4,aug".split(",").includes(q)){isQAvailable=true;};s=no+(swapped?"~":"")+(isQAvailable?("["+q+"]"):"");};e.firstChild.nodeValue=s;}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment