loleaflet/js/global.js | 23 ++++++++++++++++------- loleaflet/src/core/LOUtil.js | 9 --------- 2 files changed, 16 insertions(+), 16 deletions(-)
New commits: commit 41c21563a2a4edbdb9d6cdb2a75b6717dee760a5 Author: Henry Castro <[email protected]> AuthorDate: Mon Jul 27 10:04:07 2020 -0400 Commit: Aron Budea <[email protected]> CommitDate: Wed Jul 29 01:06:24 2020 +0200 loleaflet: move constant parameters to global initialization This should be initialized when html is loading Change-Id: Ief99d3a613ddaa86caaf5285795a97e3f56787b5 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99511 Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Jenkins Reviewed-by: Henry Castro <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99566 Reviewed-by: Aron Budea <[email protected]> diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js index 619bb91db..c1397ee99 100644 --- a/loleaflet/js/global.js +++ b/loleaflet/js/global.js @@ -2,6 +2,13 @@ /* global Uint8Array */ (function (global) { + global.getParameterByName = function (name) { + name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); + var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); + var results = regex.exec(location.search); + return results === null ? '' : results[1].replace(/\+/g, ' '); + }; + var ua = navigator.userAgent.toLowerCase(), uv = navigator.vendor.toLowerCase(), doc = document.documentElement, @@ -34,6 +41,15 @@ navigator.userAgent.toLowerCase().indexOf('trident') != -1); global.L = {}; + + global.L.Params = { + /// Shows close button if non-zero value provided + closeButtonEnabled: global.getParameterByName('closebutton'), + + /// Shows revision history file menu option + revHistoryEnabled: global.getParameterByName('revisionhistory'), + }; + global.L.Browser = { // @property ie: Boolean @@ -682,13 +698,6 @@ } }; - global.getParameterByName = function (name) { - name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); - var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); - var results = regex.exec(location.search); - return results === null ? '' : results[1].replace(/\+/g, ' '); - }; - global._ = function (string) { // In the mobile app case we can't use the stuff from l10n-for-node, as that assumes HTTP. if (window.ThisIsAMobileApp) { diff --git a/loleaflet/src/core/LOUtil.js b/loleaflet/src/core/LOUtil.js index 617d66433..27aec995a 100644 --- a/loleaflet/src/core/LOUtil.js +++ b/loleaflet/src/core/LOUtil.js @@ -1,5 +1,4 @@ /* -*- js-indent-level: 8 -*- */ -/* global getParameterByName */ /* * L.LOUtil contains various LO related utility functions used throughout the code */ @@ -162,11 +161,3 @@ L.LOUtil = { return -1; } }; - -L.Params = { - /// Shows close button if non-zero value provided - closeButtonEnabled: getParameterByName('closebutton'), - - /// Shows revision history file menu option - revHistoryEnabled: getParameterByName('revisionhistory'), -}; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
