Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Fullscreen detection #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ feature.placeholder
feature.localStorage
feature.matchMedia
feature.pictureElement
feature.fullscreen
feature.querySelectorAll
feature.remUnit
feature.serviceWorker
Expand Down
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>