|
let shiftAmount = 70; |
|
let mainContainer = document.querySelector('.main-container'); |
|
|
|
function shiftContentUp() { |
|
mainContainer.style.marginTop = "-" + shiftAmount + "%"; |
|
} |
|
|
|
function resetContent() { |
|
mainContainer.style.marginTop = "0"; |
|
} |
|
|
|
function toggleFullScreen() { |
|
if (!document.fullscreenElement) { |
|
const elementToFullScreen = document.documentElement; |
|
if (elementToFullScreen.mozRequestFullScreen) { |
|
elementToFullScreen.mozRequestFullScreen(); |
|
} else if (elementToFullScreen.webkitRequestFullscreen) { |
|
elementToFullScreen.webkitRequestFullscreen(); |
|
} else if (elementToFullScreen.msRequestFullscreen) { |
|
elementToFullScreen.msRequestFullscreen(); |
|
} |
|
} else { |
|
if (document.mozCancelFullScreen) { |
|
document.mozCancelFullScreen(); |
|
} else if (document.webkitExitFullscreen) { |
|
document.webkitExitFullscreen(); |
|
} else if (document.msExitFullscreen) { |
|
document.msExitFullscreen(); |
|
} |
|
} |
|
}; |
|
|
|
document.getElementById('message-input').addEventListener('focus', function() { |
|
if (document.fullscreenElement) { |
|
shiftContentUp(); |
|
} |
|
}); |
|
|
|
document.getElementById('message-input').addEventListener('blur', function() { |
|
if (document.fullscreenElement) { |
|
resetContent(); |
|
} |
|
}); |
|
|
|
document.addEventListener('fullscreenchange', function() { |
|
if (document.fullscreenElement) { |
|
document.getElementById('fullscreen-toggle').checked = true; |
|
} else { |
|
document.getElementById('fullscreen-toggle').checked = false; |
|
} |
|
}); |
|
|
|
document.getElementById('fullscreen-toggle').addEventListener('change', function() { |
|
toggleFullScreen(this.checked); |
|
}); |
|
|
|
|