Skip to content

Commit

Permalink
add document ready function
Browse files Browse the repository at this point in the history
  • Loading branch information
grantelgin committed Nov 25, 2012
1 parent 774f26d commit 51de800
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p3/getInTune.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var div5B = '<div id="B" class="string" style="width:30px;height:30px;border:1px solid #007cff;background-color:#06538b;color:white;font-family:sans-serif;font-weight:bold;font-size:20px;text-align:center;padding-top:10px;margin-top:5px;margin-right:5px;float:left;cursor:pointer;"><audio src="http://grantelgin.com/dwa/p3/audio/B.mp3" id="Audio_B" loop="loop"></audio>B</div>';
var div51 = '<div id="1" class="string" style="width:30px;height:30px;border:1px solid #007cff;background-color:#06538b;color:white;font-family:sans-serif;font-weight:bold;font-size:20px;text-align:center;padding-top:10px;margin-top:5px;margin-right:5px;float:left;cursor:pointer;"><audio src="http://grantelgin.com/dwa/p3/audio/1stStringE.mp3" id="Audio_1" loop="loop"></audio>e</div>';
var div6 = '<div style="clear:both;"></div><div style="color:black;font-family:sans-serif;font-size:15px;float:left;padding-top:20px;">Click a note above to hear the tone.<br>Click it again to stop.</div>';
var div7 = '<script type="text/javascript">$(".string").click(function(){thisString=$(this).attr("id");thisAudio=\'Audio_\' + thisString;thisStringElem=document.getElementById(thisAudio);if(isPlaying(thisStringElem){document.getElementById(thisAudio).pause();document.getElementById(thisAudio).currentTime=0;}else{document.getElementById(thisAudio).play();}console.log("was clicked");});function isPlaying(thisStringElem){return !thisStringElem.paused;}</script>';
var div7 = '<script type="text/javascript">$(document).ready()(function(){$(".string").click(function(){thisString=$(this).attr("id");thisAudio=\'Audio_\' + thisString;thisStringElem=document.getElementById(thisAudio);if(isPlaying(thisStringElem){document.getElementById(thisAudio).pause();document.getElementById(thisAudio).currentTime=0;}else{document.getElementById(thisAudio).play();}console.log("was clicked");});function isPlaying(thisStringElem){return !thisStringElem.paused;}});</script>';
var div8 = '</div>';

containerDiv.innerHTML = div1 + div2 + div3 + div4 + div5E + div5A + div5D + div5G + div5B + div51 + div6 + div7 + div8;
Expand Down

0 comments on commit 51de800

Please sign in to comment.