Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from moztw/timdream/mp3-audio

Add mp3 audio, close issue #1
你明明就有權限,都我在按Merge =3=
  • Loading branch information...
commit b15179143571bc7a28bc0f27161c9bcbbd08aced 2 parents 0156016 + cfa235d
@kidwm kidwm authored
View
BIN  applause.mp3
Binary file not shown
View
25 index.html
@@ -79,11 +79,26 @@
<p><a href="#">&raquo; close &laquo;</a></p>
</div>
</section>
-<audio id="melody" src="song.ogg"></audio>
-<audio class="sound" src="intro.ogg"></audio>
-<audio class="sound" src="select.ogg"></audio>
-<audio class="sound" src="match.ogg"></audio>
-<audio class="sound" src="applause.ogg"></audio>
+<audio id="melody">
+ <source src="song.ogg" type="audio/ogg; codecs=vorbis" />
+ <source src="song.mp3" type="audio/mpeg" />
+</audio>
+<audio class="sound">
+ <source src="intro.ogg" type="audio/ogg; codecs=vorbis" />
+ <source src="intro.mp3" type="audio/mpeg" />
+</audio>
+<audio class="sound">
+ <source src="select.ogg" type="audio/ogg; codecs=vorbis" />
+ <source src="select.mp3" type="audio/mpeg" />
+</audio>
+<audio class="sound">
+ <source src="match.ogg" type="audio/ogg; codecs=vorbis" />
+ <source src="match.mp3" type="audio/mpeg" />
+</audio>
+<audio class="sound">
+ <source src="applause.ogg" type="audio/ogg; codecs=vorbis" />
+ <source src="applause.mp3" type="audio/mpeg" />
+</audio>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="pxloader.js"></script>
<script src="script.js"></script>
View
BIN  intro.mp3
Binary file not shown
View
BIN  match.mp3
Binary file not shown
View
13 script.js
@@ -116,15 +116,16 @@ function init() {
$('.reset').removeClass('reset');
});
});
- if (typeof document.cancelFullScreen != 'undefined' ||
- typeof document.mozCancelFullScreen != 'undefined' ||
+ if (typeof document.cancelFullScreen != 'undefined' ||
+ typeof document.mozCancelFullScreen != 'undefined' ||
typeof document.webkitCancelFullScreen != 'undefined') {
uiFullscreen.click(toggleFullscreen);
uiFullscreen.addClass('support');
}
-
+
//Handle the audio
- if(mediaSupport('audio/ogg; codecs="theora, vorbis"', 'audio')) {
+ if(mediaSupport('audio/ogg; codecs=vorbis', 'audio') ||
+ mediaSupport('audio/mpeg', 'audio')) {
var melody = $('#melody')[0];
melody.volume = 0.15;
melody.muted = false;
@@ -245,7 +246,7 @@ function isMatchPattern() {
}
}
-//check to see if all cardmatched variable is less than 8 if so remove card only otherwise remove card and end game
+//check to see if all cardmatched variable is less than 8 if so remove card only otherwise remove card and end game
function removeTookCards() {
playSound('match');
if (cardsmatched < 8){
@@ -353,7 +354,7 @@ function mediaSupport(mimetype, container) {
* Shuffles an array or the children of a element container.
* This uses the Fisher-Yates shuffle algorithm <http://jsfromhell.com/array/shuffle [v1.0]>
*/
-
+
(function($){
$.fn.shuffle = function() {
View
BIN  select.mp3
Binary file not shown
View
8 site.appcache
@@ -1,10 +1,12 @@
CACHE MANIFEST
# Renew this hash every time to invalidate current cache
-# hash 2e0d29f27a02ee07451331cf36555a8f
+# hash 3b03d847946a415808ebb81d83e4b145
+
# Files to ask browsers to cache even when user hits reload
CACHE:
./applause.ogg
+./applause.mp3
./images/card.png
./images/cr.png
./images/end.png
@@ -32,12 +34,16 @@ CACHE:
./images/start.png
./images/tb.png
./intro.ogg
+./intro.mp3
./match.ogg
+./match.mp3
./pxloader.js
./script.js
./select.ogg
+./select.mp3
./site.appcache
./song.ogg
+./song.mp3
./style.css
# Yes, it also works for remote files, but we will be unable to track their changes
View
BIN  song.mp3
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.