uketabs.html
· 1.1 KiB · 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");
// If multiple chords, support these separators
$.each(",|/", function(i,s){
if (tabs.indexOf(s) != -1) tabs = tabs.split(s);
});
// If only one chord, we need an array
if (!$.isArray(tabs)) {
tabs = [tabs];
}
for (var i=0;i<tabs.length;i++) {
if (tabs[i].indexOf("#") == -1) {
newimg = $("<img class='tabimg'>")
newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png")
newimg.appendTo($('#display'))
} else if (!window.sharpalertshown) {
alert("All sharp chords must be converted to their flat counterpart (D# = Eb)");
window.sharpalertshown = true;
}
}
}
$("#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 | // 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> |