loleaflet/src/control/Control.Menubar.js |    6 +++---
 loleaflet/src/core/LOUtil.js             |    3 +++
 loleaflet/src/main.js                    |    5 -----
 loleaflet/src/map/Map.js                 |    4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 617d7e13183dfd9c0819181e4e2ad40e251a3b0c
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Mon Jan 6 16:22:09 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon Jan 6 21:42:37 2020 +0100

    loleaflet: move global variable 'revHistoryEnabled'
    
    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: I9fe144dea6bf36abd16fcf00259acca93674eff9
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86308
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index 97b42a14c..55dd7b409 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -3,7 +3,7 @@
 * Control.Menubar
 */
 
-/* global $ _ _UNO vex revHistoryEnabled L */
+/* global $ _ _UNO vex L */
 L.Control.Menubar = L.Control.extend({
        // TODO: Some mechanism to stop the need to copy duplicate menus (eg. 
Help)
        options: {
@@ -1134,7 +1134,7 @@ L.Control.Menubar = L.Control.extend({
                        this._map.showHyperlinkDialog();
                } else if (id === 'keyboard-shortcuts' || id === 'online-help') 
{
                        this._map.showHelp(id);
-               } else if (revHistoryEnabled && (id === 'rev-history' || id === 
'last-mod')) {
+               } else if (L.Params.revHistoryEnabled && (id === 'rev-history' 
|| id === 'last-mod')) {
                        // if we are being loaded inside an iframe, ask
                        // our host to show revision history mode
                        this._map.fire('postMessage', {msgId: 'rev-history', 
args: {Deprecated: true}});
@@ -1289,7 +1289,7 @@ L.Control.Menubar = L.Control.extend({
                }
 
                if (menuItem.type === 'action') {
-                       if ((menuItem.id === 'rev-history' && 
!revHistoryEnabled) ||
+                       if ((menuItem.id === 'rev-history' && 
!L.Params.revHistoryEnabled) ||
                                (menuItem.id === 'closedocument' && 
!window.closebutton)) {
                                return false;
                        }
diff --git a/loleaflet/src/core/LOUtil.js b/loleaflet/src/core/LOUtil.js
index 780f83a8f..f540e6da2 100644
--- a/loleaflet/src/core/LOUtil.js
+++ b/loleaflet/src/core/LOUtil.js
@@ -116,4 +116,7 @@ L.LOUtil = {
 L.Params = {
        /// Shows close button if non-zero value provided
        closeButtonEnabled: getParameterByName('closebutton'),
+
+       /// Shows revision history file menu option
+       revHistoryEnabled: getParameterByName('revisionhistory'),
 };
diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index 45373715e..fb7890b36 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -26,8 +26,6 @@ if (reuseCookies !== '') {
 var filePath = getParameterByName('file_path');
 var permission = getParameterByName('permission') || 'edit';
 var timestamp = getParameterByName('timestamp');
-// Shows revision history file menu option
-var revHistoryEnabled = getParameterByName('revisionhistory');
 // Should the document go inactive or not
 var alwaysActive = getParameterByName('alwaysactive');
 // Loleaflet Debug mode
@@ -39,9 +37,6 @@ if (host === '' && !window.ThisIsAMobileApp) {
        vex.dialog.alert(errorMessages.emptyhosturl);
 }
 
-// loleaflet.js accesses these globals
-// TODO: Get rid of these globals
-global.revHistoryEnabled = revHistoryEnabled;
 var docURL, docParams;
 var isWopi = false;
 if (wopiSrc != '') {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 74795391e..ef557f6c1 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -24,7 +24,7 @@ function isAnyVexDialogActive() {
        return res;
 }
 
-/* global vex revHistoryEnabled $ _ */
+/* global vex $ _ */
 L.Map = L.Evented.extend({
 
        options: {
@@ -387,7 +387,7 @@ L.Map = L.Evented.extend({
                        lastModButton.firstChild.innerHTML = '';
                        lastModButton.firstChild.appendChild(mainSpan);
 
-                       if (revHistoryEnabled) {
+                       if (L.Params.revHistoryEnabled) {
                                L.DomUtil.setStyle(lastModButton, 'cursor', 
'pointer');
                        }
                }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to