Skip to content

Commit

Permalink
Support Fullscreen detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Croft committed Jan 18, 2016
1 parent ce96d51 commit 2a3f130
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@
// Test if Picture element is supported
pictureElement : ("HTMLPictureElement" in window),

// Test if fullscreen is supported
fullscreen : (function(el) {
var test = ["requestFullscreen", "webkitRequestFullscreen",
"webkitRequestFullScreen" , "mozRequestFullScreen", "msRequestFullscreen"];
for (var prop in test) {
if (el[test[prop]]) {
return true;
}
}
return false;
})(util.create("video")),

// Run all the tests and add supported classes
testAll : function() {
var classes = " js";
Expand Down
9 changes: 9 additions & 0 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ <h4>Context Menu</h4>
<menuitem label="FEATURE.JS TEST MENU ITEM" onclick="window.location.reload();"></menuitem>
</menu>

<h4>Fullscreen</h4>
<div class="test" id="fullscreen"></div>

</div>
<script>
Expand Down Expand Up @@ -166,6 +168,7 @@ <h4>Context Menu</h4>
log(feature.webGL, "WebGL");
log(feature.cors, "CORS");
log(feature.touch, "Touch");
log(feature.fullscreen, "Fullscreen");

// 3D Transforms
if (feature.css3Dtransform) {
Expand Down Expand Up @@ -355,6 +358,12 @@ <h4>Context Menu</h4>
needsContextMenu.className += " active";
}

// Fullscreen
if(feature.fullscreen) {
var needsFullscreen = document.getElementById("fullscreen");
needsFullscreen.className += " active";
}

</script>
</body>
</html>

0 comments on commit 2a3f130

Please sign in to comment.