mike-jumper commented on a change in pull request #470: GUACAMOLE-124: Add 
full-screen action
URL: https://github.com/apache/guacamole-client/pull/470#discussion_r383100250
 
 

 ##########
 File path: guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js
 ##########
 @@ -134,6 +134,48 @@ angular.module('navigation').directive('guacUserMenu', 
[function guacUserMenu()
                 return authenticationService.isAnonymous();
             };
 
+            /**
+             * Requests fullscreen for the Guacamole page.
+             */
+            $scope.fullscreen = function fullscreen() {
+                var elem = document.documentElement;
+                var fullscreenElem = !(!document.fullscreenElement &&
+                    !document.msFullscreenElement &&
+                    !document.mozFullScreenElement &&
+                    !document.webkitFullscreenElement);
+
+                if (!fullscreenElem) {
+                    if (!elem.requestFullscreen) {
+                        elem.requestFullscreen = (elem.mozRequestFullScreen
+                                || elem.webkitRequestFullscreen
+                                || elem.msRequestFullscreen).bind(elem);
+                    }
+
+                    if (elem.requestFullscreen) {
+                        elem.requestFullscreen();
+                    }
 
 Review comment:
   This appears to anticipate that there may not be any `requestFullscreen()` 
implementation, even browser-specific prefix versions. That's good, but such a 
case would also cause the previous call to `bind()` to fail, as 
`elem.mozRequestFullScreen || elem.webkitRequestFullscreen || 
elem.msRequestFullscreen` would not evaluate to something that has `bind()`.
   
   I'd recommend avoiding both of these issues entirely, adding an anonymous 
stub function at the end of that chain of `||`, thus ensuring there is always a 
version of `requestFullscreen()` (even if it does nothing).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to