actually go into fullscreen in distraction free mode

This commit is contained in:
Hendrik Leppelsack 2016-12-01 15:11:44 +01:00
parent 046cb26194
commit bd65e87395
5 changed files with 53 additions and 16 deletions

View File

@ -135,7 +135,7 @@
}
#app-content .note-meta-right {
float: right;
float: right;
}
#app-content .saving {
@ -210,19 +210,29 @@
/* distraction free styles */
.distraction-free #header,
.distraction-free #navigation,
.distraction-free #app-navigation,
.distraction-free #app-navigation-toggle {
display: none;
:-webkit-full-screen {
width: 100%;
}
:-moz-full-screen {
width: 100%;
}
:-ms-fullscreen {
width: 100%;
}
:fullscreen {
width: 100%;
}
.distraction-free #content-wrapper {
padding-top: 0;
:-webkit-full-screen #app-content-container {
margin: 0 auto;
}
.distraction-free #app-content-container {
max-width: 1000px;
:-moz-full-screen #app-content-container {
margin: 0 auto;
}
:-ms-fullscreen #app-content-container {
margin: 0 auto;
}
:fullscreen #app-content-container {
margin: 0 auto;
}

View File

@ -28,8 +28,35 @@ app.controller('NoteController', function($routeParams, $scope, NotesModel,
}, 300);
$scope.toggleDistractionFree = function() {
var body = angular.element(document).find('body')[0];
body.classList.toggle('distraction-free');
function launchIntoFullscreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
function exitFullscreen() {
if(document.exitFullscreen) {
document.exitFullscreen();
} else if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if(document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
if(document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement) {
exitFullscreen();
} else {
launchIntoFullscreen(document.getElementById('app-content'));
}
};
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,6 @@
<div class="note-meta">
{{note.content | wordCount}}
<span class="note-meta-right">
<button class="icon-fullscreen has-tooltip" notes-tooltip ng-click="toggleDistractionFree()" title="test"></button>
<button class="icon-fullscreen has-tooltip" notes-tooltip ng-click="toggleDistractionFree()"></button>
</span>
</div>