Skip to content

Commit

Permalink
Switched to Modernizr for feature detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonidas-from-XIV committed Sep 1, 2011
1 parent d203693 commit 80b5a5f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions index.html
Expand Up @@ -4,6 +4,7 @@
<title>Shadowrun dice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js"></script>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="lib/preconfig.js"></script>
<script src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
Expand All @@ -14,14 +15,17 @@
<audio id="roll-dice-jingle">
<source src="static/diceboard.ogg" />
<source src="static/diceboard.mp3" />
<source src="static/diceboard.wav" />
</audio>
<audio id="glitch-jingle">
<source src="static/glitch.ogg" />
<source src="static/glitch.mp3" />
<source src="static/glitch.wav" />
</audio>
<audio id="critical-jingle">
<source src="static/critical.ogg" />
<source src="static/critical.mp3" />
<source src="static/critical.wav" />
</audio>
<div data-role="page" id="main-page">
<div data-role="header">Shadowrun dice generator</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/logic.js
Expand Up @@ -50,7 +50,7 @@
};
play = function(audio) {
var html5audio;
html5audio = !!(document.createElement('audio').canPlayType);
html5audio = Modernizr.audio.ogg || Modernizr.audio.mp3 || Modernizr.audio.wav;
if (html5audio) {
return audio[0].play();
}
Expand Down
2 changes: 1 addition & 1 deletion src/logic.coffee
Expand Up @@ -41,7 +41,7 @@ playRoll = ->
play $ "#roll-dice-jingle"

play = (audio) ->
html5audio = !!(document.createElement('audio').canPlayType)
html5audio = Modernizr.audio.ogg or Modernizr.audio.mp3 or Modernizr.audio.wav
audio[0].play() if html5audio
# else phonegap fallback

Expand Down

0 comments on commit 80b5a5f

Please sign in to comment.