mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-06 08:44:02 +01:00
Fullscreen icon now changing on event handler
No longer detecting current image src and showing the opposite icon on click We're now changing the icon on screen change event handler
This commit is contained in:
@@ -47,6 +47,8 @@ var ICEcoder = {
|
||||
|
||||
// On load, set the layout and get the nest location
|
||||
init: function() {
|
||||
var screenIcon, sISrc;
|
||||
|
||||
// Set layout & the nest location
|
||||
ICEcoder.setLayout();
|
||||
|
||||
@@ -64,6 +66,14 @@ var ICEcoder = {
|
||||
tab.addEventListener('dragend', ICEcoder.handleDragEnd, false);
|
||||
});
|
||||
setInterval(ICEcoder.updateNestingIndicator,30);
|
||||
|
||||
// Setup fullscreen detection and change icon
|
||||
screenIcon = top.document.getElementById('screenMode');
|
||||
sISrc = ["images/restored-screen.gif","images/full-screen.gif"];
|
||||
document.addEventListener("fullscreenchange", function () {screenIcon.src = document.fullscreen ? sISrc[0] : sISrc[1];}, false);
|
||||
document.addEventListener("mozfullscreenchange", function () {screenIcon.src = document.mozFullScreen ? sISrc[0] : sISrc[1];}, false);
|
||||
document.addEventListener("webkitfullscreenchange", function () {screenIcon.src = document.webkitIsFullScreen ? sISrc[0] : sISrc[1];}, false);
|
||||
|
||||
top.ICEcoder.ready = true;
|
||||
},
|
||||
|
||||
@@ -1307,10 +1317,6 @@ var ICEcoder = {
|
||||
|
||||
// Toggle full screen on/off
|
||||
fullScreenSwitcher: function() {
|
||||
var screenIcon;
|
||||
|
||||
screenIcon = top.document.getElementById('screenMode');
|
||||
|
||||
// Future use
|
||||
if ("undefined" != typeof document.cancelFullScreen) {
|
||||
document.fullScreen ? document.cancelFullScreen() : document.body.requestFullScreen();
|
||||
@@ -1321,8 +1327,6 @@ var ICEcoder = {
|
||||
} else if ("undefined" != typeof document.webkitCancelFullScreen) {
|
||||
document.webkitIsFullScreen ? document.webkitCancelFullScreen() : document.body.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
}
|
||||
|
||||
screenIcon.src = screenIcon.src.indexOf("images/full-screen.gif") > -1 ? "images/restored-screen.gif" : "images/full-screen.gif";
|
||||
},
|
||||
|
||||
// Pass target file/folder to Zip It!
|
||||
|
||||
Reference in New Issue
Block a user