diff options
| author | Zach DeCook <zachdecook@gmail.com> | 2018-03-12 22:04:39 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@gmail.com> | 2018-03-12 22:04:39 -0400 |
| commit | 31e0f3007da1460275beea9703912856531b975a (patch) | |
| tree | 20252cde18ea9fe086082e922c5d6030026e3242 /jsonly.js | |
| parent | 7a9d59c4b9c5ff3fbe11453c6dbed03fc6f5c240 (diff) | |
| download | prosongsa-31e0f3007da1460275beea9703912856531b975a.tar.gz | |
* Easy Transp buttons: Fix JS
Diffstat (limited to 'jsonly.js')
| -rw-r--r-- | jsonly.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/jsonly.js b/jsonly.js index 9e1cf2d..257c762 100644 --- a/jsonly.js +++ b/jsonly.js @@ -29,10 +29,13 @@ function do_transpose() console.log($(this)); var oldKey = $(this).attr('data-key'); var newKey = transpadd(oldKey, transp - lastTransp); - $(this).removeClass('btn-'+oldKey); - $(this).addClass('btn-'+newKey); - $(this).attr('data-key', newKey); - $(this).text( $(this).attr('data-words') + newKey ); + if ( typeof newKey !== 'undefined' ) + { + $(this).removeClass('btn-'+oldKey); + $(this).addClass('btn-'+newKey); + $(this).attr('data-key', newKey); + $(this).text( $(this).attr('data-words') + newKey ); + } var tt = parseInt($(this).attr('href').match(/transp=(.+)/)[1]); tt = ( transp - lastTransp + 24 + tt)%12; var newhref = $(this).attr('href').match(/(.*?&transp=).+/)[1] + tt; @@ -107,4 +110,4 @@ function getChordFrets(chord) });*/ $("#messages").prepend("Couldn't find a chord for '"+ chord +"'"); } -} \ No newline at end of file +} |
