uketabs.html
· 1.4 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.split) 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.bind("error", function(e){
e.target.style.display="none"
});
newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png");
newimg.appendTo($('#display'));
}
}
}
$("#form").bind("submit", function(e){
e.preventDefault();
$("#display").empty();
showtabs()
});
</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.split) 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.bind("error", function(e){ |
| 36 | e.target.style.display="none" |
| 37 | }); |
| 38 | newimg.attr("src", "https://ukutabs.com/chords/" + tabs[i] + "%20.png"); |
| 39 | newimg.appendTo($('#display')); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | $("#form").bind("submit", function(e){ |
| 45 | e.preventDefault(); |
| 46 | $("#display").empty(); |
| 47 | showtabs() |
| 48 | }); |
| 49 | |
| 50 | </script> |
| 51 | </body> |
| 52 | </html> |