uketabs.html
· 1.3 KiB · HTML
Raw
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>UkeTabGenerator</title>
</head>
<body>
<form id="form">
<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♭">
<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) {
if (!window.sharpalertshown) alert("All sharp chords must be converted to their flat counterpart (D# = Eb)");
window.sharpalertshown = true;
}
else if (tabs[i].indexOf("n") != -1) {
$("<br>").appendTo($('#display'));
} else {
newimg = $("<img class='tabimg'>")
newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png")
newimg.appendTo($('#display'));
}
}
}
$("#form").submit(function(){
$('#display').empty();
showtabs();
return false;
});
</script>
</body>
</html>
| 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 | |
| 16 | function 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> |