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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 18 22:16:25 UTC 2018


 loleaflet/html/loleaflet.html.m4 |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 7159fcb54d03e8bdb53bb0a2c132ea59365ec857
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Sep 19 01:04:22 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Sep 19 01:06:41 2018 +0300

    Add Base64ToArrayBuffer() JavaScript function
    
    Used for use sending tiles from the iOS app code to the JavaScript.

diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index 88b33009a..8ae22bbd1 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -11,8 +11,8 @@ define([_foreachq],[ifelse([$#],[3],[],[define([$1],[$4])$2[]$0([$1],[$2],shift(
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
-ifelse(IOSAPP,[],
 <script>
+ifelse(IOSAPP,[],
   // Start listening for Host_PostmessageReady message and save the
   // result for future
   window.WOPIpostMessageReady = false;
@@ -28,9 +28,19 @@ ifelse(IOSAPP,[],
     }
   };
   window.addEventListener('message', PostMessageReadyListener, false);
-</script>
 )dnl
 
+var Base64ToArrayBuffer = function(base64Str) {
+  var binStr = atob(base64Str);
+  var ab = new ArrayBuffer(binStr.length);
+  var bv = new Uint8Array(ab);
+  for (var i = 0, l = binStr.length; i < l; i++) {
+    bv[[i]] = binStr.charCodeAt(i);
+  }
+  return ab;
+}
+</script>
+
 ifelse(IOSAPP,[true],
   ifelse(DEBUG,[true],
     foreachq([fileCSS],[LOLEAFLET_CSS],[<link rel="stylesheet" href="fileCSS" />


More information about the Libreoffice-commits mailing list