Last active 1481515504

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

Revision 67532d91fe0df0e2e0f3e3350b58e8a9bd697113

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