uketabs.html
· 966 B · HTML
Raw
<!DOCTYPE html>
<html>
<head>
<title>UkeTabGenerator</title>
</head>
<body>
<form id="form">
<input type="text" id="tabs" value="Eb,F7,Bb7,Gb,Eb,Gbaug">
<input type="submit">
</form>
<div id="display"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script>
function showtabs() {
var tabs = $("input#tabs").val().replace(/♭/g, "b");
$.each(",|/", function(i,s){
if (tabs.indexOf(s) != -1) tabs = tabs.split(s);
});
for (var i=0;i<tabs.length;i++) {
newimg = $("<img class='tabimg'>")
newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png")
newimg.error(function(e){
alert(tabs[i] + " doesn't seem to be a valid chord. Keep in mind that sharp chords need to be converted to their flat alternatives (D# = Eb)");
});
newimg.appendTo($('#display'))
}
}
$("#form").submit(function(){
$('#display').empty();
showtabs();
return false;
});
</script>
</body>
</html>
| 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 | |
| 15 | function showtabs() { |
| 16 | var tabs = $("input#tabs").val().replace(/♭/g, "b"); |
| 17 | $.each(",|/", function(i,s){ |
| 18 | if (tabs.indexOf(s) != -1) tabs = tabs.split(s); |
| 19 | }); |
| 20 | for (var i=0;i<tabs.length;i++) { |
| 21 | newimg = $("<img class='tabimg'>") |
| 22 | newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png") |
| 23 | newimg.error(function(e){ |
| 24 | alert(tabs[i] + " doesn't seem to be a valid chord. Keep in mind that sharp chords need to be converted to their flat alternatives (D# = Eb)"); |
| 25 | }); |
| 26 | newimg.appendTo($('#display')) |
| 27 | } |
| 28 | } |
| 29 | $("#form").submit(function(){ |
| 30 | $('#display').empty(); |
| 31 | showtabs(); |
| 32 | return false; |
| 33 | }); |
| 34 | |
| 35 | </script> |
| 36 | </body> |
| 37 | </html> |