[Libreoffice-commits] online.git: loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 6 20:25:11 UTC 2020


 loleaflet/src/core/Browser.js           |    7 +++++++
 loleaflet/src/layer/marker/TextInput.js |    2 +-
 loleaflet/src/main.js                   |    4 ----
 loleaflet/src/map/Clipboard.js          |   14 +++++++-------
 4 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit f2017bbbc4d5554882739c6ada04c0dbfd9bedc3
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Jan 6 14:32:46 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Jan 6 21:24:52 2020 +0100

    loleaflet: move global variable "isInternetExplorer" to L.Browser object
    
    To identify Browser, it has a specific section in L.Browser object
    that detects any type of browser, so let us be consistent and move
    the global variable "isInternetExplorer"
    
    Change-Id: I3f744ea21a2e051a0ad4255fcd280af4549b6ef7
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86292
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/core/Browser.js b/loleaflet/src/core/Browser.js
index 9f6b765e0..c17fc0641 100644
--- a/loleaflet/src/core/Browser.js
+++ b/loleaflet/src/core/Browser.js
@@ -44,6 +44,9 @@
 	var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||
 			(window.DocumentTouch && document instanceof window.DocumentTouch));
 
+	var isInternetExplorer = (navigator.userAgent.toLowerCase().indexOf('msie') != -1 ||
+			navigator.userAgent.toLowerCase().indexOf('trident') != -1);
+
 	L.Browser = {
 
 		// @property ie: Boolean
@@ -92,6 +95,10 @@
 		// `true` for all Internet Explorer versions supporting CSS transforms.
 		ie3d: ie3d,
 
+		// @property isInternetExplorer: Boolean
+		// `true` for Internet Explorer
+		isInternetExplorer: isInternetExplorer,
+
 		// @property webkit3d: Boolean
 		// `true` for webkit-based browsers supporting CSS transforms.
 		webkit3d: webkit3d,
diff --git a/loleaflet/src/layer/marker/TextInput.js b/loleaflet/src/layer/marker/TextInput.js
index b23355595..22b904632 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -211,7 +211,7 @@ L.TextInput = L.Layer.extend({
 			this._textArea.style.height = '1px';
 			this._textArea.style.caretColor = 'transparent';
 
-			if (window.isInternetExplorer || L.Browser.edge)
+			if (L.Browser.isInternetExplorer || L.Browser.edge)
 			{
 				// Setting the font-size to zero is the only reliable
 				// way to hide the caret in MSIE11, as the CSS "caret-color"
diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index f8340a844..f4b7be0c9 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -41,10 +41,6 @@ if (host === '' && !window.ThisIsAMobileApp) {
 	vex.dialog.alert(errorMessages.emptyhosturl);
 }
 
-var isInternetExplorer = (navigator.userAgent.toLowerCase().indexOf('msie') != -1
-			|| navigator.userAgent.toLowerCase().indexOf('trident') != -1);
-global.isInternetExplorer = isInternetExplorer;
-
 // loleaflet.js accesses these globals
 // TODO: Get rid of these globals
 global.revHistoryEnabled = revHistoryEnabled;
diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index 65ab6d1ab..a3a4c3add 100644
--- a/loleaflet/src/map/Clipboard.js
+++ b/loleaflet/src/map/Clipboard.js
@@ -40,7 +40,7 @@ L.Clipboard = L.Class.extend({
 
 		var that = this;
 		var beforeSelect = function(ev) { return that._beforeSelect(ev); }
-		if (window.isInternetExplorer)
+		if (L.Browser.isInternetExplorer)
 		{
 			document.addEventListener('cut',   function(ev)   { return that.cut(ev); });
 			document.addEventListener('copy',  function(ev)   { return that.copy(ev); });
@@ -61,7 +61,7 @@ L.Clipboard = L.Class.extend({
 	},
 
 	compatRemoveNode: function(node) {
-		if (window.isInternetExplorer)
+		if (L.Browser.isInternetExplorer)
 			node.removeNode(true);
 		else // standard
 			node.parentNode.removeChild(node);
@@ -455,7 +455,7 @@ L.Clipboard = L.Class.extend({
 	populateClipboard: function(ev) {
 		this._checkSelection();
 
-		if (window.isInternetExplorer)
+		if (L.Browser.isInternetExplorer)
 		{
 			var that = this;
 			setTimeout(function() { that._resetDiv(); }, 0);
@@ -494,7 +494,7 @@ L.Clipboard = L.Class.extend({
 	},
 
 	_beforeSelectImpl: function(operation) {
-		if (window.isInternetExplorer && operation != 'paste')
+		if (L.Browser.isInternetExplorer && operation != 'paste')
 			// We need populate our content into the div for
 			// the brower to copy.
 			this._dummyDiv.innerHTML = this._getHtmlForClipboard();
@@ -508,7 +508,7 @@ L.Clipboard = L.Class.extend({
 
 		var selected = false;
 		var selectRange;
-		if (window.isInternetExplorer && operation != 'paste')
+		if (L.Browser.isInternetExplorer && operation != 'paste')
 		{
 			this._dummyDiv.focus();
 
@@ -572,7 +572,7 @@ L.Clipboard = L.Class.extend({
 		var serial = this._clipboardSerial;
 
 		// try a direct execCommand.
-		if (window.isInternetExplorer && operation != 'paste')
+		if (L.Browser.isInternetExplorer && operation != 'paste')
 			this._beforeSelectImpl(operation);
 		if (document.execCommand(operation) &&
 		    serial !== this._clipboardSerial) {
@@ -651,7 +651,7 @@ L.Clipboard = L.Class.extend({
 			ev.usePasteKeyEvent = true;
 
 		var that = this;
-		if (window.isInternetExplorer)
+		if (L.Browser.isInternetExplorer)
 		{
 			var active = document.activeElement;
 			// Can't get HTML until it is pasted ... so quick timeout


More information about the Libreoffice-commits mailing list