Commits

Yang Zhang committed 445cfd2

add sound

Comments (0)

Files changed (2)

 //for zendict2 project
+sound_link = "https://dl.dropbox.com/u/17635554/voice/";
+
 $(function(){
 
 
     return word.replace(/ /g,'_').replace(/([(]|[)]|[/]|[-]|['])/g,'');
 }
 
+function playWord(word){
+    var startLetter= word[0];
+    var playLink = sound_link + startLetter+'/'+word+'.wav';
+    var snd = new Audio(playLink); // buffers automatically when created
+    snd.play();
 
+}
 
 function do_suggestion(){
     var word = $('#word_search').val().trim();

templates/js_template.html

     </h1>
     <ul class="wordmeaning">{{#wordmeaning}}
         <p class="phticsym">{{phticsym}}
-            <a href='#'><i class="icon-headphones icon-large"></i></a>
+            <a href='javascript:void(0)' onclick='playWord("{{spell}}")'><i class="icon-headphones icon-large"></i></a>
         </p>
         <p class = "category">{{category}}</p>
         <ol class="meaning">{{#meanings}}