Last active 1481515504

A javascript thing to get ukulele tab charts quickly. https://b303.me/uketabs.html

Revision 2dd091229b1386a43de6b3d4273c83f7d0bf8dbe

uketabs.html Raw
1<!DOCTYPE html>
2<html>
3 <head>
4 <title>UkeTabGenerator</title>
5 </head>
6 <body>
7 <form id="form">
8 <input type="text" id="tabs" value="Eb,F7,Bb7,Gb,Eb,Gbaug">
9 <input type="submit">
10 </form>
11 <div id="display"></div>
12 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
13 <script>
14
15function showtabs() {
16 var tabs = $("input#tabs").val().replace(/♭/g, "b");
17 // If multiple chords, support these separators
18 $.each(",|/", function(i,s){
19 if (tabs.indexOf(s) != -1) tabs = tabs.split(s);
20 });
21 // If only one chord, we need an array
22 if (!$.isArray(tabs)) {
23 tabs = [tabs];
24 }
25 for (var i=0;i<tabs.length;i++) {
26 if (tabs[i].indexOf("#") == -1) {
27 newimg = $("<img class='tabimg'>")
28 newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png")
29 newimg.appendTo($('#display'))
30 } else if (!window.sharpalertshown) {
31 alert("All sharp chords must be converted to their flat counterpart (D# = Eb)");
32 window.sharpalertshown = true;
33 }
34 }
35}
36$("#form").submit(function(){
37 $('#display').empty();
38 showtabs();
39 return false;
40});
41
42 </script>
43 </body>
44</html>