loleaflet: move global variable 'closeButtonEnabled'

There are global variables when the early websocket connection
is in progress while the bundle JS file is being downloaded,
so in order to not confuse it is preferable to move to another location.

Change-Id: I36b3e52c87666c5a805c2286af45ec5b44d79619
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86296
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Henry Castro 2020-01-06 15:33:12 -04:00
parent f2017bbbc4
commit 2f6c4acf82
4 changed files with 10 additions and 6 deletions

View file

@ -2599,9 +2599,9 @@ function setupToolbar(e) {
map.on('commandstatechanged', onCommandStateChanged);
map.on('commandvalues', onCommandValues, this);
if (!window.closeButtonEnabled) {
if (!L.Params.closeButtonEnabled) {
$('#closebuttonwrapper').hide();
} else if (window.closeButtonEnabled && !L.Browser.mobile) {
} else if (L.Params.closeButtonEnabled && !L.Browser.mobile) {
$('#closebuttonwrapper').show();
$('.closebuttonimage').show();
}

View file

@ -1,4 +1,5 @@
/* -*- js-indent-level: 8 -*- */
/* global getParameterByName */
/*
* L.LOUtil contains various LO related utility functions used throughout the code
*/
@ -111,3 +112,8 @@ L.LOUtil = {
return res;
}
};
L.Params = {
/// Shows close button if non-zero value provided
closeButtonEnabled: getParameterByName('closebutton'),
};

View file

@ -26,8 +26,6 @@ if (reuseCookies !== '') {
var filePath = getParameterByName('file_path');
var permission = getParameterByName('permission') || 'edit';
var timestamp = getParameterByName('timestamp');
// Shows close button if non-zero value provided
window.closeButtonEnabled = getParameterByName('closebutton');
// Shows revision history file menu option
var revHistoryEnabled = getParameterByName('revisionhistory');
// Should the document go inactive or not

View file

@ -1676,7 +1676,7 @@ L.Map = L.Evented.extend({
if (!this.isMenubarHidden())
return;
$('.main-nav').show();
if (window.closeButtonEnabled && !window.mode.isTablet()) {
if (L.Params.closeButtonEnabled && !window.mode.isTablet()) {
$('#closebuttonwrapper').show();
}
@ -1694,7 +1694,7 @@ L.Map = L.Evented.extend({
if (this.isMenubarHidden())
return;
$('.main-nav').hide();
if (window.closeButtonEnabled) {
if (L.Params.closeButtonEnabled) {
$('#closebuttonwrapper').hide();
}