Move the window.mode.* functions to global.js for clarity

No idea why they were in Control.Toolbar.js.

Change-Id: I18ab812317b4bfb71d0c63a4cb2283d4fbaa3b54
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91087
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist 2020-03-26 10:42:32 +02:00
parent 63605979d8
commit 3a5d193fdc
2 changed files with 19 additions and 20 deletions

View file

@ -141,6 +141,25 @@
retina: (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1 retina: (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1
}; };
global.mode = {
// Here "mobile" means "mobile phone" (at least for now). Has to match small screen size
// requirement.
isMobile: function() {
if (L.Browser.mobile && L.Browser.cypressTest) {
return true;
}
return L.Browser.mobile && screen.width < 768;
},
// Mobile device with big screen size.
isTablet: function() {
return L.Browser.mobile && !window.mode.isMobile();
},
isDesktop: function() {
return !L.Browser.mobile;
}
};
document.addEventListener('contextmenu', function(e) { document.addEventListener('contextmenu', function(e) {
if (e.preventDefault) { if (e.preventDefault) {
e.preventDefault(); e.preventDefault();

View file

@ -15,26 +15,6 @@ function onDelete(e) {
} }
} }
// Make functions visible outside: window.mode.isMobile() etc.
global.mode = {
// Here "mobile" means "mobile phone" (at least for now). Has to match small screen size
// requirement.
isMobile: function() {
if (L.Browser.mobile && L.Browser.cypressTest) {
return true;
}
return L.Browser.mobile && screen.width < 768;
},
// Mobile device with big screen size.
isTablet: function() {
return L.Browser.mobile && !window.mode.isMobile();
},
isDesktop: function() {
return !L.Browser.mobile;
}
};
var nUsers, oneUser, noUser; var nUsers, oneUser, noUser;
function _updateVisibilityForToolbar(toolbar) { function _updateVisibilityForToolbar(toolbar) {