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

2020-09-09 Thread Pranam Lashkari (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |4 ++--
 loleaflet/src/control/Control.FormulaBar.js  |3 ++-
 loleaflet/src/control/Control.MobileBottomBar.js |2 +-
 loleaflet/src/control/Control.MobileTopBar.js|2 +-
 loleaflet/src/control/Control.PresentationBar.js |3 ++-
 loleaflet/src/control/Control.SearchBar.js   |2 +-
 loleaflet/src/control/Control.SheetsBar.js   |3 ++-
 loleaflet/src/control/Control.SigningBar.js  |3 ++-
 loleaflet/src/control/Control.StatusBar.js   |3 +--
 loleaflet/src/control/Control.TopToolbar.js  |2 +-
 10 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 89061cda512e5900280caef656a975364ff73e5d
Author: Pranam Lashkari 
AuthorDate: Wed Sep 9 01:30:07 2020 +0530
Commit: Andras Timar 
CommitDate: Wed Sep 9 11:52:42 2020 +0200

leaflet: replaced w2ui tooltip with jquery tooltip

makes UI more consistent with notebookbar
some tooltip used to go out of screen on edges

Change-Id: I306591146c21cc9d4f2d92361f411628a91f3d89
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102277
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 96a5320bd..d8226ea23 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -6067,7 +6067,7 @@ w2utils.event = {
 html += '';
 } else {
 html += ''+
+'class="'+ (it.disabled ? 'disabled' : '') +'" 
valign="middle" title="'+ (it.hint ? it.hint : "") + '">'
 '';
 }
 }
@@ -6193,7 +6193,7 @@ w2utils.event = {
 var html = '';
 if (item.caption != null && item.text == null) item.text = 
item.caption; // for backward compatibility
 if (item.text == null) item.text = '';
-if (item.tooltip == null && item.hint != null) item.tooltip = 
item.hint; // for backward compatibility
+
 if (item.tooltip == null) item.tooltip = '';
 var img  = '';
 var text = item.text;
diff --git a/loleaflet/src/control/Control.FormulaBar.js 
b/loleaflet/src/control/Control.FormulaBar.js
index 60fd848d9..b58353d82 100644
--- a/loleaflet/src/control/Control.FormulaBar.js
+++ b/loleaflet/src/control/Control.FormulaBar.js
@@ -26,7 +26,6 @@ L.Control.FormulaBar = L.Control.extend({
var toolbar = $('#formulabar');
toolbar.w2toolbar({
name: 'formulabar',
-   tooltip: 'bottom',
hidden: true,
items: [
{type: 'html',  id: 'left'},
@@ -43,6 +42,8 @@ L.Control.FormulaBar = L.Control.extend({
$('#addressInput').off('keyup', 
that.onAddressInput.bind(that)).on('keyup', that.onAddressInput.bind(that));
}
});
+   toolbar.tooltip();
+
toolbar.bind('touchstart', function(e) {
w2ui['formulabar'].touchStarted = true;
var touchEvent = e.originalEvent;
diff --git a/loleaflet/src/control/Control.MobileBottomBar.js 
b/loleaflet/src/control/Control.MobileBottomBar.js
index 340e8d1ab..be3dd0062 100644
--- a/loleaflet/src/control/Control.MobileBottomBar.js
+++ b/loleaflet/src/control/Control.MobileBottomBar.js
@@ -109,7 +109,6 @@ L.Control.MobileBottomBar = L.Control.extend({
var toolbar = $('#toolbar-down');
toolbar.w2toolbar({
name: 'editbar',
-   tooltip: 'top',
items: toolItems,
onClick: function (e) {
// use global handler
@@ -124,6 +123,7 @@ L.Control.MobileBottomBar = L.Control.extend({
window.insertShapes();
}
});
+
toolbar.bind('touchstart', function(e) {
w2ui['editbar'].touchStarted = true;
var touchEvent = e.originalEvent;
diff --git a/loleaflet/src/control/Control.MobileTopBar.js 
b/loleaflet/src/control/Control.MobileTopBar.js
index d754f0a19..05fd7c7ed 100644
--- a/loleaflet/src/control/Control.MobileTopBar.js
+++ b/loleaflet/src/control/Control.MobileTopBar.js
@@ -71,13 +71,13 @@ L.Control.MobileTopBar = L.Control.extend({
var toolbar = $('#toolbar-up');
toolbar.w2toolbar({
name: 'actionbar',
-   tooltip: 'bottom',
items: toolItems,
onClick: function (e) {
that.onClick(e, e.target);
window.hideTooltip(this, e.target);
}
  

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

2020-08-07 Thread Jan Holesovsky (via logerrit)
 loleaflet/js/global.js |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 6d67da6669dfe8002cb58300ccdbf12e852b2d19
Author: Jan Holesovsky 
AuthorDate: Fri Aug 7 13:49:32 2020 +0200
Commit: Jan Holesovsky 
CommitDate: Fri Aug 7 14:09:59 2020 +0200

android: Chromebook is not a touch device, avoid using Hammer there.

This fixes the mouse wheel - now it works on the chromebooks.

Change-Id: I5bf2a7e1ae397ef171221ac58172940bb43cbb3c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100227
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 61c7fedde..0b39b8d21 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -34,8 +34,10 @@
gecko3d = 'MozPerspective' in doc.style,
opera12 = 'OTransition' in doc.style;
 
+   var chromebook = window.ThisIsTheAndroidApp && 
window.LOOLMessageHandler.isChromeOS();
+
var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window 
||
-   (window.DocumentTouch && document instanceof 
window.DocumentTouch));
+   (window.DocumentTouch && document instanceof 
window.DocumentTouch)) && !chromebook;
 
var isInternetExplorer = 
(navigator.userAgent.toLowerCase().indexOf('msie') != -1 ||
navigator.userAgent.toLowerCase().indexOf('trident') != 
-1);
@@ -160,10 +162,7 @@
 
global.mode = {
isChromebook: function() {
-   if (!window.ThisIsTheAndroidApp)
-   return false;
-
-   return window.LOOLMessageHandler.isChromeOS();
+   return chromebook;
},
// Here "mobile" means "mobile phone" (at least for now). Has 
to match small screen size
// requirement.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-27 Thread Henry Castro (via logerrit)
 loleaflet/js/global.js   |   23 ---
 loleaflet/src/core/LOUtil.js |9 -
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 0bd70f83d9e444cf0ea5e3caabab9cc0e504033e
Author: Henry Castro 
AuthorDate: Mon Jul 27 10:04:07 2020 -0400
Commit: Henry Castro 
CommitDate: Mon Jul 27 18:25:58 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 
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index f1046a3c9..61c7fedde 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 + 

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

2020-07-17 Thread Henry Castro (via logerrit)
 loleaflet/js/jquery.mCustomScrollbar.js |4 
 1 file changed, 4 deletions(-)

New commits:
commit 7946e46257f89f04e4fe108bb8b8a9c163be05d3
Author: Henry Castro 
AuthorDate: Fri Jul 17 10:10:28 2020 -0400
Commit: Henry Castro 
CommitDate: Fri Jul 17 17:57:29 2020 +0200

mCustomScrollbar: IFrame access is not allowed

Due to security reasons, the access object from IFrame
is restricted and throw exceptions. So always return false
by default when using this component.

Change-Id: Ib297ee49c563c2d4c6eb63a794284d3d3cfe79e8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98978
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index eba3ccefe..14ed699d2 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1564,10 +1564,6 @@ and dependencies (minified).
return _canAccessIFrameCache[cacheKey];
}
if(!iframe){
-   try{
-   var doc=top.document;
-   html=doc.body.innerHTML;
-   }catch(err){/* do nothing */}
result=(html!==null);
}else{
try{
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-17 Thread Henry Castro (via logerrit)
 loleaflet/js/jquery.mCustomScrollbar.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5727976b8e8556e9a49e3618feda3ae8d95f
Author: Henry Castro 
AuthorDate: Fri Jul 17 09:56:14 2020 -0400
Commit: Henry Castro 
CommitDate: Fri Jul 17 17:56:46 2020 +0200

mCustomScrollbar: fix "Uncaught TypeError: Cannot read property"

Running a local nextcloud instance, it throws an uncaught type error.

Change-Id: I48f553f4e4a4704fa4f2753e9af5207c4d95e5f9
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98977
Tested-by: Jenkins CollaboraOffice 
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index f147bc2e8..eba3ccefe 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1210,7 +1210,7 @@ and dependencies (minified).

mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
draggable,dragY,dragX,
rds=o.advanced.releaseDraggableSelectors ? 
mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
-   eds=o.advanced.extraDraggableSelectors ? 
$(!_canAccessIFrame() || 
top.document).add($(o.advanced.extraDraggableSelectors)) : 
$(!_canAccessIFrame() || top.document);
+   eds=o.advanced.extraDraggableSelectors ? 
$(!_canAccessIFrame() || 
top.document).add($(o.advanced.extraDraggableSelectors)) : $(_canAccessIFrame() 
? top.document : false);

mCSB_dragger.bind("contextmenu."+namespace,function(e){
e.preventDefault(); //prevent right 
click
}).bind("mousedown."+namespace+" 
touchstart."+namespace+" pointerdown."+namespace+" 
MSPointerDown."+namespace,function(e){
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-16 Thread gokaysatir (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ebc46c8ecc8e32fa76847ef701db962a86c5a286
Author: gokaysatir 
AuthorDate: Thu Jul 16 13:40:25 2020 +0300
Commit: Henry Castro 
CommitDate: Thu Jul 16 15:24:07 2020 +0200

loleaflet: Hide tooltips on tablet.

Change-Id: I4c4381919b41cbe3b276a15d3070f56e3ce78359
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98894
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 4ff42eed2..96a5320bd 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -6266,7 +6266,7 @@ w2utils.event = {
 },
 
 tooltipShow: function (id, event, forceRefresh) {
-if (window.mode.isMobile()) { return; }
+if (window.mode.isMobile() || window.mode.isTablet()) { return; }
 if (window.ThisIsTheiOSApp) return;
 if (this.tooltip == null) return;
 var $el  = $(this.box).find('#tb_'+ this.name + '_item_'+ 
w2utils.escapeId(id));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-15 Thread gokaysatir (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 9aae80518d23dab3dbd8fdc9369b61d70798ea67
Author: gokaysatir 
AuthorDate: Sat Jul 11 14:35:26 2020 +0300
Commit: Henry Castro 
CommitDate: Wed Jul 15 14:51:04 2020 +0200

loleaflet: Hide w2ui tooltips on mobile.

Change-Id: Iaf57e6f53fbc363e22ac1c11de0eb657d492edd3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98558
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 533941987..4ff42eed2 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -6266,6 +6266,7 @@ w2utils.event = {
 },
 
 tooltipShow: function (id, event, forceRefresh) {
+if (window.mode.isMobile()) { return; }
 if (window.ThisIsTheiOSApp) return;
 if (this.tooltip == null) return;
 var $el  = $(this.box).find('#tb_'+ this.name + '_item_'+ 
w2utils.escapeId(id));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-29 Thread mert (via logerrit)
 loleaflet/js/global.js |   35 +++
 1 file changed, 23 insertions(+), 12 deletions(-)

New commits:
commit f8f6189bdd0c75b86d12268cfa97a7090ddbbe4d
Author: mert 
AuthorDate: Wed Jun 24 19:39:32 2020 +0300
Commit: Andras Timar 
CommitDate: Mon Jun 29 08:33:27 2020 +0200

Fix url errors on backgroundImage in css files for proxy

Current replacing url strings method works fine,
however, it does not cover all the rules
for cases like when @media or @import are used.
They have a subset of their own rules which must
be covered as well.

Change-Id: Ib10f7cc361aea5cd3b855f64e3a64566a6c51a12
Signed-off-by: mert 
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97071
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 3420b9c13..0ed660e69 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -571,20 +571,16 @@
{
// re-write relative URLs in CSS - somewhat grim.
window.addEventListener('load', function() {
-   var sheets = document.styleSheets;
-   for (var i = 0; i < sheets.length; ++i) {
-   var relBases = sheets[i].href.split('/');
-   relBases.pop(); // bin last - css name.
-   var replaceBase = 'url("' + relBases.join('/') 
+ '/images/';
+   var replaceUrls = function(rules, replaceBase) {
+   if (!rules)
+   return;
 
-   var rules;
-   try {
-   rules = sheets[i].cssRules || 
sheets[i].rules;
-   } catch (err) {
-   console.log('Missing CSS from ' + 
sheets[i].href);
-   continue;
-   }
for (var r = 0; r < rules.length; ++r) {
+   // check subset of rules like @media or 
@import
+   if (rules[r] && rules[r].type != 1) {
+   replaceUrls(rules[r].cssRules 
|| rules[r].rules, replaceBase);
+   continue;
+   }
if (!rules[r] || !rules[r].style)
continue;
var img = 
rules[r].style.backgroundImage;
@@ -596,6 +592,21 @@

img.replace('url("images/', replaceBase);
}
}
+   };
+   var sheets = document.styleSheets;
+   for (var i = 0; i < sheets.length; ++i) {
+   var relBases = sheets[i].href.split('/');
+   relBases.pop(); // bin last - css name.
+   var replaceBase = 'url("' + relBases.join('/') 
+ '/images/';
+
+   var rules;
+   try {
+   rules = sheets[i].cssRules || 
sheets[i].rules;
+   } catch (err) {
+   console.log('Missing CSS from ' + 
sheets[i].href);
+   continue;
+   }
+   replaceUrls(rules, replaceBase);
}
}, false);
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-11 Thread gokaysatir (via logerrit)
 loleaflet/js/jquery.mCustomScrollbar.js  |4 ++--
 loleaflet/package.json   |2 +-
 loleaflet/src/control/Control.Toolbar.js |2 +-
 loleaflet/src/control/Toolbar.js |3 +++
 4 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 489155f3a747c4b7323b4f1d1186e7722dd44906
Author: gokaysatir 
AuthorDate: Wed Jun 10 13:16:31 2020 +0300
Commit: Andras Timar 
CommitDate: Thu Jun 11 13:00:52 2020 +0200

leaflet: update jquery package.

Change-Id: I1d637b957808ae5938cf2ee7fe5c3f20e6b9cc52
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95856
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index ffd8e1bba..f147bc2e8 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -883,9 +883,9 @@ and dependencies (minified).
_pluginMarkup=function(){
var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
expandClass=o.autoExpandScrollbar ? " 
"+classes[1]+"_expand" : "",
-   scrollbar=["",""],
+   scrollbar=["",""],
wrapperClass=o.axis==="yx" ? 
"mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
-   scrollbars=o.axis==="yx" ? 
scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
+   scrollbars=o.axis==="yx" ? 
scrollbar[0]+scrollbar[1] : (o.axis==="x" ? scrollbar[1] : scrollbar[0]),
contentWrapper=o.axis==="yx" ? "" : "",
autoHideClass=o.autoHideScrollbar ? " 
"+classes[6] : "",
scrollbarDirClass=(o.axis!=="x" && 
d.langDir==="rtl") ? " "+classes[7] : "";
diff --git a/loleaflet/package.json b/loleaflet/package.json
index 7a1aba5d0..d081f4eb9 100644
--- a/loleaflet/package.json
+++ b/loleaflet/package.json
@@ -10,7 +10,7 @@
 "d3": "5.16.0",
 "eslint": "3.0.0",
 "hammerjs": "2.0.8",
-"jquery": "2.2.4",
+"jquery": "3.5.1",
 "jquery-contextmenu": "2.9.2",
 "jquery-mousewheel": "3.1.13",
 "jquery-ui-dist": "1.12.1",
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 500ca36b5..4a797ffb0 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -476,7 +476,7 @@ function insertShapes(mobile) {
var width = 10;
var $grid = $('.insertshape-grid');
 
-   if ($grid.children().size() > 0)
+   if ($grid.children().length > 0)
return;
 
for (var s in shapes) {
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index fdeec58af..2f6f28ad6 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -612,6 +612,9 @@ L.Map.include({
map.sendUnoCommand('.uno:SetHyperlink', 
command);
map.focus();
}
+   else {
+   map.focus();
+   }
}
});
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-11 Thread Andras Timar (via logerrit)
 loleaflet/js/jquery.mCustomScrollbar.js |  786 
 1 file changed, 393 insertions(+), 393 deletions(-)

New commits:
commit 8ea0b6acbcbe691cd31cabd1a357602591c94860
Author: Andras Timar 
AuthorDate: Thu Jun 11 12:15:01 2020 +0200
Commit: Andras Timar 
CommitDate: Thu Jun 11 13:00:13 2020 +0200

jquery.mCustomScrollbar.js: whitespace changes only

Change-Id: I23eadea7e0581ab068588af444794697c1d86bb5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96113
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index 79bf0521f..ffd8e1bba 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1,8 +1,8 @@
 /* -*- js-indent-level: 8; indent-tabs-mode: t; fill-column: 120 -*- */
 /*
-== malihu jquery custom scrollbar plugin == 
+== malihu jquery custom scrollbar plugin ==
 Version: 3.1.5
-Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
+Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller
 Author: malihu
 Author URI: http://manos.malihu.gr
 License: MIT License (MIT)
@@ -31,10 +31,10 @@ THE SOFTWARE.
 */
 
 /*
-The code below is fairly long, fully commented and should be normally used in 
development. 
-For production, use either the minified jquery.mCustomScrollbar.min.js script 
or 
-the production-ready jquery.mCustomScrollbar.concat.min.js which contains the 
plugin 
-and dependencies (minified). 
+The code below is fairly long, fully commented and should be normally used in 
development.
+For production, use either the minified jquery.mCustomScrollbar.min.js script 
or
+the production-ready jquery.mCustomScrollbar.concat.min.js which contains the 
plugin
+and dependencies (minified).
 */
 
 (function(factory){
@@ -55,60 +55,60 @@ and dependencies (minified).
if(_njs){
require("jquery-mousewheel")($);
}else{
-   /* load jquery-mousewheel plugin (via CDN) if it's not 
present or not loaded via RequireJS 
+   /* load jquery-mousewheel plugin (via CDN) if it's not 
present or not loaded via RequireJS
(works when mCustomScrollbar fn is called on window 
load) */
$.event.special.mousewheel || 
$("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
}
}
init();
 }(function(){
-   
-   /* 
+
+   /*

-   PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
+   PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S)

*/
-   
+
var pluginNS="mCustomScrollbar",
pluginPfx="mCS",
defaultSelector=".mCustomScrollbar",
-   
-   
-   
-   
-   
-   /* 
+
+
+
+
+
+   /*

-   DEFAULT OPTIONS 
+   DEFAULT OPTIONS

*/
-   
+
defaults={
/*
-   set element/content width/height programmatically 
-   values: boolean, pixels, percentage 
+   set element/content width/height programmatically
+   values: boolean, pixels, percentage
option  
default
-
setWidth
false
setHeight   
false
*/
/*
-   set the initial css top property of content  
+   set the initial css top property of content
values: string (e.g. "-100px", "10%" etc.)
*/
setTop:0,
/*
-   set the initial css left property of content  
+   set the initial css left property of content
values: string (e.g. "-100px", "10%" etc.)
*/
setLeft:0,
-   /* 
-   scrollbar axis (vertical and/or horizontal scrollbars) 
+   /*
+   scrollbar axis (vertical and/or horizontal scrollbars)
values (string): "y", "x", "yx"
*/
axis:"y",
/*
-   position of scrollbar relative to content  
+   position of scrollbar relative to content
 

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

2020-06-09 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 28517a499391273aa5bf2ec32e02012d5bfc5313
Author: Michael Meeks 
AuthorDate: Tue Jun 9 11:29:11 2020 +0100
Commit: Michael Meeks 
CommitDate: Tue Jun 9 12:43:05 2020 +0200

Proxy: detect un-responsive sockets & close after 30secs.

Also:
+ fix double poll timer in error
+ remove & rename incorrect interval timer names

Change-Id: Idfae44c0a388312b248c78fc9ad04fe3725990b6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95910
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index d033e2f64..3420b9c13 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -350,14 +350,16 @@
};
this.sendQueue = '';
this._signalErrorClose = function() {
+   clearInterval(this.pollInterval);
+   clearTimeout(this.delaySession);
+   this.pollInterval = undefined;
+   this.delaySession = undefined;
+
if (that.readyState < 3)
{
this.onerror();
this.onclose();
}
-   clearInterval(this.waitInterval);
-   clearTimeout(this.delaySession);
-   this.waitInterval = undefined;
this.sessionId = 'open';
this.inSerial = 0;
this.outSerial = 0;
@@ -365,9 +367,14 @@
this.openInflight = 0;
this.readyState = 3; // CLOSED
};
+   // For those who think that long-running sockets are a
+   // better way to wait: you're so right. However, each
+   // consumes a scarce server worker thread while it waits,
+   // so ... back in the real world:
this._setPollInterval = function(intervalMs) {
-   clearInterval(that.pollInterval);
-   that.pollInterval = setInterval(that.doSend, 
intervalMs);
+   clearInterval(this.pollInterval);
+   if (this.readyState === 1)
+   this.pollInterval = setInterval(this.doSend, 
intervalMs);
},
this.doSend = function () {
if (that.sessionId === 'open')
@@ -388,6 +395,11 @@
console.debug('High latency connection 
- too much in-flight, throttling to ' + that.curPollMs + ' ms.');
that._setPollInterval(that.curPollMs);
}
+   else if (performance.now() - 
that.lastDataTimestamp > 30 * 1000)
+   {
+   console.debug('Close connection after 
no response for 30secs');
+   that._signalErrorClose();
+   }
else
console.debug('High latency connection 
- too much in-flight, pausing.');
return;
@@ -490,12 +502,7 @@
that.sessionId = this.responseText;
that.readyState = 1;
that.onopen();
-
-   // For those who think that 
long-running sockets are a
-   // better way to wait: you're so right. 
However, each
-   // consumes a scarce server worker 
thread while it waits,
-   // so ... back in the real world:
-   that.pollInterval = 
setInterval(that.doSend, that.curPollMs);
+   that._setPollInterval(that.curPollMs);
}
});
req.addEventListener('loadend', function() {
@@ -540,9 +547,9 @@
console.debug('proxy: close socket');
this.readyState = 3;
this.onclose();
-   clearInterval(this.waitInterval);
+   clearInterval(this.pollInterval);
clearTimeout(this.delaySession);
-   this.waitInterval = undefined;
+   this.pollInterval = undefined;
if (oldState === 1) // was open
this.sendCloseMsg(this.unloading);
this.sessionId = 'open';
___

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

2020-06-09 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   35 ---
 1 file changed, 16 insertions(+), 19 deletions(-)

New commits:
commit 19b544477e3f425fb55ca6e51be255860c6b13b1
Author: Michael Meeks 
AuthorDate: Tue Jun 9 10:44:30 2020 +0100
Commit: Michael Meeks 
CommitDate: Tue Jun 9 12:02:56 2020 +0200

Proxy: don't implement a magic re-connecting socket.

Websockets don't magically re-connect, so we shouldn't either.
Also avoid starting our send interval timer until we've opened
to simplify.

Change-Id: Id71049da2d4b4d0ac2f38a3d7410f2446d04f0b1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95906
Tested-by: Jenkins CollaboraOffice 
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index d50739193..d033e2f64 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -354,15 +354,15 @@
{
this.onerror();
this.onclose();
-   clearInterval(this.waitInterval);
-   clearTimeout(this.delaySession);
-   this.waitInterval = undefined;
-   this.sessionId = 'open';
-   this.inSerial = 0;
-   this.outSerial = 0;
-   this.msgInflight = 0;
-   this.openInflight = 0;
}
+   clearInterval(this.waitInterval);
+   clearTimeout(this.delaySession);
+   this.waitInterval = undefined;
+   this.sessionId = 'open';
+   this.inSerial = 0;
+   this.outSerial = 0;
+   this.msgInflight = 0;
+   this.openInflight = 0;
this.readyState = 3; // CLOSED
};
this._setPollInterval = function(intervalMs) {
@@ -373,10 +373,7 @@
if (that.sessionId === 'open')
{
if (that.readyState === 3)
-   {
-   console.debug('Session closed, opening 
a new one.');
-   that.getSessionId();
-   }
+   console.debug('Error: sending on closed 
socket');
return;
}
 
@@ -488,11 +485,17 @@
console.debug('Error: failed to fetch 
session id! error: ' + this.status);
that._signalErrorClose();
}
-   else
+   else // we connected - lets get going ...
{
that.sessionId = this.responseText;
that.readyState = 1;
that.onopen();
+
+   // For those who think that 
long-running sockets are a
+   // better way to wait: you're so right. 
However, each
+   // consumes a scarce server worker 
thread while it waits,
+   // so ... back in the real world:
+   that.pollInterval = 
setInterval(that.doSend, that.curPollMs);
}
});
req.addEventListener('loadend', function() {
@@ -555,12 +558,6 @@
 
// queue fetch of session id.
this.getSessionId();
-
-   // For those who think that long-running sockets are a
-   // better way to wait: you're so right. However, each
-   // consumes a scarce server worker thread while it waits,
-   // so ... back in the real world:
-   this.pollInterval = setInterval(this.doSend, this.curPollMs);
};
 
if (global.socketProxy)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-08 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   46 +-
 1 file changed, 41 insertions(+), 5 deletions(-)

New commits:
commit 58e5016917e325248fdb01a83030051c3a3df975
Author: Michael Meeks 
AuthorDate: Mon Jun 8 15:46:29 2020 +0100
Commit: Michael Meeks 
CommitDate: Mon Jun 8 21:18:47 2020 +0200

Proxy: handle server startup / un-responsive DocumentBroker creation.

If our 'open' request fails - then we could get this loop:

loadDocument (proxy.php?req=/loleaflet/d2d049224/src/map/Map.js:318)
_activate (proxy.php?req=/loleaflet/d2d049224/src/map/Map.js:1233)
_onSocketClose (proxy.php?req=/loleaflet/d2d049224/src/core/Socket.js:1045)
_signalErrorClose 
(proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:576)
(anonymous) 
(proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:688)
load (async)
getSessionId 
(proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:682)
global.ProxySocket 
(proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:753)
global.createWebSocket 
(proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:798)
connect (proxy.php?req=/loleaflet/d2d049224/src/core/Socket.js:52)
loadDocument (proxy.php?req=/loleaflet/d2d049224/src/map/Map.js:318)

Which would hammer the server with large numbers of requests triggering
DoS protection in some cases, so:
1. only allow one 'open' in-flight at a time
2. global time-accounting to not allow >1 new ProxySocket every 250ms
3. handle error returns from 'open' correctly.

Change-Id: I1692acd72a445ebc70a83c66a2e802a532c66e21
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95837
Tested-by: Jenkins
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 47bc7b648..d50739193 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -221,6 +221,7 @@
this.id = window.proxySocketCounter++;
this.sendCounter = 0;
this.msgInflight = 0;
+   this.openInflight = 0;
this.inSerial = 0;
this.outSerial = 0;
this.minPollMs = 25; // Anything less than ~25 ms can overwhelm 
the HTTP server.
@@ -354,8 +355,13 @@
this.onerror();
this.onclose();
clearInterval(this.waitInterval);
+   clearTimeout(this.delaySession);
this.waitInterval = undefined;
this.sessionId = 'open';
+   this.inSerial = 0;
+   this.outSerial = 0;
+   this.msgInflight = 0;
+   this.openInflight = 0;
}
this.readyState = 3; // CLOSED
};
@@ -371,9 +377,6 @@
console.debug('Session closed, opening 
a new one.');
that.getSessionId();
}
-   else
-   console.debug('New session not 
completed.');
-
return;
}
 
@@ -448,14 +451,41 @@
that.msgInflight++;
};
this.getSessionId = function() {
+   if (this.openInflight > 0)
+   {
+   console.debug('Waiting for session open');
+   return;
+   }
+
+   if (this.delaySession)
+   return;
+
+   // avoid attempting to re-connect too quickly
+   if (global.lastCreatedProxySocket)
+   {
+   var msSince = performance.now() - 
global.lastCreatedProxySocket;
+   if (msSince < 250) {
+   var delay = 250 - msSince;
+   console.debug('Wait to re-try session 
creation for ' + delay + 'ms');
+   this.curPollMs = delay; // ms
+   this.delaySession = 
setTimeout(function() {
+   that.delaySession = undefined;
+   that.getSessionId();
+   }, delay);
+   return;
+   }
+   }
+   global.lastCreatedProxySocket = performance.now();
+

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

2020-06-08 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6232ff7184e3aaa7b98707a3c6963bab52c26cee
Author: Michael Meeks 
AuthorDate: Mon Jun 8 14:48:57 2020 +0100
Commit: Michael Meeks 
CommitDate: Mon Jun 8 17:14:17 2020 +0200

Proxy: only send close if we were connected.

Change-Id: I4b80adb1d4f44efc02b784cad10f27e458921449
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95836
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 6430ec908..47bc7b648 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -498,12 +498,14 @@
navigator.sendBeacon(url, '');
};
this.close = function() {
+   var oldState = this.readyState;
console.debug('proxy: close socket');
this.readyState = 3;
this.onclose();
clearInterval(this.waitInterval);
this.waitInterval = undefined;
-   this.sendCloseMsg(this.unloading);
+   if (oldState === 1) // was open
+   this.sendCloseMsg(this.unloading);
this.sessionId = 'open';
};
this.setUnloading = function() {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-04 Thread gokaysatir (via logerrit)
 loleaflet/js/global.js |8 
 1 file changed, 8 deletions(-)

New commits:
commit 9a4952dccc0f5113ebed7bb1eeb2e05650510916
Author: gokaysatir 
AuthorDate: Thu Jun 4 15:09:13 2020 +0300
Commit: Henry Castro 
CommitDate: Thu Jun 4 15:52:47 2020 +0200

leaflet: Remove old jquery-fixer code.

Change-Id: I15796cdbb21295215699eefe4ecbe25f37d4e567
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95509
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 1c951b089..6430ec908 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -606,14 +606,6 @@
};
}
 
-   // fix jquery-ui
-   // var jQuery = require('jquery');
-   global.require = function (path) {
-   if (path=='jquery') {
-   return global.jQuery;
-   }
-   };
-
global.getParameterByName = function (name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + 

[Libreoffice-commits] online.git: loleaflet/js wsd/LOOLWSD.cpp

2020-06-02 Thread Ashod Nakashian (via logerrit)
 loleaflet/js/global.js |   11 +--
 wsd/LOOLWSD.cpp|6 +++---
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 4513318e58ed22709637374918fec3a95ad5dcab
Author: Ashod Nakashian 
AuthorDate: Mon Jun 1 08:18:13 2020 -0400
Commit: Ashod Nakashian 
CommitDate: Tue Jun 2 20:05:19 2020 +0200

wsd: leaflet: fix reuse_cookies support

reuse_cookies is now always encoded in the URL.

And, there is no need for the WOPISrc in the three cases
in this patch, and by passing the DocumentURI proper
(without /ws?WOPISrc=...) ensures that all query-params
in the DocumentURI are properly processed.

This fixes the reuse_cookies regression where it
wasn't passed to WOPI requests.

Change-Id: I8dccfb09a7b4102d10c1aef24f43b699a07bfed8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95293
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Ashod Nakashian 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 20757e2a5..1c951b089 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -653,9 +653,16 @@
else if (global.accessHeader !== '') {
wopiParams = { 'access_header': global.accessHeader };
}
-   else if (global.reuseCookies !== '') {
-   wopiParams = { 'reuse_cookies': global.reuseCookies };
+
+   if (global.reuseCookies !== '') {
+   if (wopiParams) {
+   wopiParams['reuse_cookies'] = 
global.reuseCookies;
+   }
+   else {
+   wopiParams = { 'reuse_cookies': 
global.reuseCookies };
+   }
}
+
if (wopiParams) {
docParams = Object.keys(wopiParams).map(function(key) {
return encodeURIComponent(key) + '=' + 
encodeURIComponent(wopiParams[key]);
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 51bd22e38..db7bfbaef 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2810,7 +2810,7 @@ private:
 const std::string formName(form.get("name"));
 
 // Validate the docKey
-const std::string decodedUri = 
requestDetails.getLegacyDocumentURI();
+const std::string decodedUri = requestDetails.getDocumentURI();
 const std::string docKey = 
DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri));
 
 std::unique_lock docBrokersLock(DocBrokersMutex);
@@ -2846,7 +2846,7 @@ private:
 // TODO: Check that the user in question has access to this file!
 
 // 1. Validate the dockey
-const std::string decodedUri = 
requestDetails.getLegacyDocumentURI();
+const std::string decodedUri = requestDetails.getDocumentURI();
 const std::string docKey = 
DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri));
 
 std::unique_lock docBrokersLock(DocBrokersMutex);
@@ -3025,7 +3025,7 @@ private:
SocketDisposition& disposition,
const std::shared_ptr& socket)
 {
-const std::string url = requestDetails.getLegacyDocumentURI();
+const std::string url = requestDetails.getDocumentURI();
 assert(socket && "Must have a valid socket");
 
 // must be trace for anonymization
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-02 Thread gokaysatir (via logerrit)
 loleaflet/js/jquery.mCustomScrollbar.js |   85 ++--
 1 file changed, 60 insertions(+), 25 deletions(-)

New commits:
commit 42a36a5da36b661ee0b0b6e998ddc622df3f3c2c
Author: gokaysatir 
AuthorDate: Tue Jun 2 12:09:02 2020 +0300
Commit: Henry Castro 
CommitDate: Tue Jun 2 14:54:06 2020 +0200

leaflet: update mcustomscrollbar.js file.

Change-Id: I8adf3a8370b307c532ab64ad439f75ebfe318ebe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95301
Tested-by: Jenkins CollaboraOffice 
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index 42876a14e..79bf0521f 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1,7 +1,7 @@
 /* -*- js-indent-level: 8; indent-tabs-mode: t; fill-column: 120 -*- */
 /*
 == malihu jquery custom scrollbar plugin == 
-Version: 3.1.3 
+Version: 3.1.5
 Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
 Author: malihu
 Author URI: http://manos.malihu.gr
@@ -38,7 +38,9 @@ and dependencies (minified).
 */
 
 (function(factory){
-   if(typeof module!=="undefined" && module.exports){
+   if(typeof define==="function" && define.amd){
+   define(["jquery"],factory);
+   }else if(typeof module!=="undefined" && module.exports){
module.exports=factory;
}else{
factory(jQuery,window,document);
@@ -1178,8 +1180,8 @@ and dependencies (minified).

/* returns input coordinates of pointer, touch and mouse events 
(relative to document) */
_coordinates=function(e){
-   var t=e.type,o=e.target.ownerDocument!==document ? 
[$(frameElement).offset().top,$(frameElement).offset().left] : null,
-   io=_canAccessIFrame() && 
e.target.ownerDocument!==top.document ? 
[$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : 
[0,0];
+   var t=e.type,o=e.target.ownerDocument!==document && 
frameElement!==null ? 
[$(frameElement).offset().top,$(frameElement).offset().left] : null,
+   io=_canAccessIFrame() && 
e.target.ownerDocument!==top.document && frameElement!==null ? 
[$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : 
[0,0];
switch(t){
case "pointerdown": case "MSPointerDown": case 
"pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
return o ? 
[e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : 
[e.originalEvent.pageY,e.originalEvent.pageX,false];
@@ -1209,13 +1211,15 @@ and dependencies (minified).
draggable,dragY,dragX,
rds=o.advanced.releaseDraggableSelectors ? 
mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
eds=o.advanced.extraDraggableSelectors ? 
$(!_canAccessIFrame() || 
top.document).add($(o.advanced.extraDraggableSelectors)) : 
$(!_canAccessIFrame() || top.document);
-   mCSB_dragger.bind("mousedown."+namespace+" 
touchstart."+namespace+" pointerdown."+namespace+" 
MSPointerDown."+namespace,function(e){
+   
mCSB_dragger.bind("contextmenu."+namespace,function(e){
+   e.preventDefault(); //prevent right 
click
+   }).bind("mousedown."+namespace+" 
touchstart."+namespace+" pointerdown."+namespace+" 
MSPointerDown."+namespace,function(e){
e.stopImmediatePropagation();
e.preventDefault();
if(!_mouseBtnLeft(e)){return;} /* left mouse 
button only */
touchActive=true;

if(oldIE){document.onselectstart=function(){return false;}} /* disable text 
selection for IE < 9 */
-   _iframe(false); /* enable scrollbar dragging 
over iframes by disabling their events */
+   _iframe.call(mCSB_container,false); /* enable 
scrollbar dragging over iframes by disabling their events */
_stop($this);
draggable=$(this);
var coordinates = _coordinates(e);
@@ -1247,14 +1251,8 @@ and dependencies (minified).
}
touchActive=false;
if(oldIE){document.onselectstart=null;} /* 
enable text selection for IE < 9 */
-   _iframe(true); /* enable iframes events */
+   _iframe.call(mCSB_container,true); /* enable 
iframes events */
 

[Libreoffice-commits] online.git: loleaflet/js loleaflet/package.json

2020-06-01 Thread gokaysatir (via logerrit)
 loleaflet/js/l10n.js   |2 +-
 loleaflet/package.json |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ee098941a82a8bca8d90af0e663f6c2ec880d54b
Author: gokaysatir 
AuthorDate: Mon Jun 1 11:21:23 2020 +0300
Commit: Henry Castro 
CommitDate: Mon Jun 1 17:16:13 2020 +0200

update uglify-js package.

Change-Id: Ic1298127d186a094e81ffc58a9ed35f82948cb1f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95267
Tested-by: Jenkins CollaboraOffice 
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/loleaflet/js/l10n.js b/loleaflet/js/l10n.js
index 4beab6e7a..b8706298f 100644
--- a/loleaflet/js/l10n.js
+++ b/loleaflet/js/l10n.js
@@ -130,7 +130,7 @@ var
return Function.prototype[$to_locale_string].apply(String_ctr, 
arguments);
 }
 , loadFromDisk = String_ctr[$to_locale_string] = function (uri) {
-const fs = require('fs');
+var fs = require('fs');
 var read = fs.readFileSync(uri, 'utf8');
 return JSON.parse(read);
 }
diff --git a/loleaflet/package.json b/loleaflet/package.json
index c8fbbf9e0..0d41c6091 100644
--- a/loleaflet/package.json
+++ b/loleaflet/package.json
@@ -20,7 +20,7 @@
 "select2": "4.0.13",
 "shrinkpack": "1.0.0-alpha",
 "smartmenus": "1.0.0",
-"uglify-js": "2.4.24",
+"uglify-js": "3.9.4",
 "uglifycss": "0.0.27",
 "uglifyify": "3.0.2",
 "vex-js": "4.1.0"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am loleaflet/package.json

2020-06-01 Thread gokaysatir (via logerrit)
 loleaflet/Makefile.am   |2 
 loleaflet/js/select2.js | 2760 ++--
 loleaflet/package.json  |2 
 3 files changed, 2007 insertions(+), 757 deletions(-)

New commits:
commit d478b2d030cee45ba52be4842b0d8b1bf3344af3
Author: gokaysatir 
AuthorDate: Mon Jun 1 10:27:28 2020 +0300
Commit: Andras Timar 
CommitDate: Mon Jun 1 15:30:30 2020 +0200

update select2 package.

Change-Id: I8ff53d838e80011f110bd427e26adcd372d9a2fb
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95217
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 1e51e4156..3f68dcf12 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -100,7 +100,7 @@ LOLEAFLET_ADMIN_JS =\
 NODE_MODULES_SRC =\
autolinker@3.14.1 \
json-js@1.1.2 \
-   select2@4.0.1 \
+   select2@4.0.13 \
vex-js@4.1.0 \
l10n-for-node@0.0.1 \
@braintree/sanitize-url@4.0.1
diff --git a/loleaflet/js/select2.js b/loleaflet/js/select2.js
index 61e08e00b..e6631ae31 100644
--- a/loleaflet/js/select2.js
+++ b/loleaflet/js/select2.js
@@ -1,470 +1,488 @@
 /*!
- * Select2 4.0.1
+ * Select2 4.0.13
  * https://select2.github.io
  *
  * Released under the MIT license
  * https://github.com/select2/select2/blob/master/LICENSE.md
  */
-(function (factory) {
+;(function (factory) {
   if (typeof define === 'function' && define.amd) {
 // AMD. Register as an anonymous module.
 define(['jquery'], factory);
-  } else if (typeof exports === 'object') {
+  } else if (typeof module === 'object' && module.exports) {
 // Node/CommonJS
-factory(require('jquery'));
+module.exports = function (root, jQuery) {
+  if (jQuery === undefined) {
+// require('jQuery') returns a factory that requires window to
+// build a jQuery instance, we normalize how we use modules
+// that require this pattern but the window provided is a noop
+// if it's defined (how jquery works)
+if (typeof window !== 'undefined') {
+  jQuery = require('jquery');
+}
+else {
+  jQuery = require('jquery')(root);
+}
+  }
+  factory(jQuery);
+  return jQuery;
+};
   } else {
 // Browser globals
 factory(jQuery);
   }
-}(function (jQuery) {
+} (function (jQuery) {
   // This is needed so we can catch the AMD loader configuration and use it
   // The inner file should be wrapped (by `banner.start.js`) in a function that
   // returns the AMD loader references.
-  var S2 =
-(function () {
+  var S2 =(function () {
   // Restore the Select2 AMD loader so it can be used
   // Needed mostly in the language files, where the loader is not inserted
   if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
 var S2 = jQuery.fn.select2.amd;
   }
-var S2;(function () { if (!S2 || !S2.requirejs) {
-if (!S2) { S2 = {}; } else { require = S2; }
-/**
- * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All 
Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/almond for details
- */
-//Going sloppy to avoid 'use strict' string cost, but strict practices should
-//be followed.
-/*jslint sloppy: true */
-/*global setTimeout: false */
-
-var requirejs, require, define;
-(function (undef) {
-var main, req, makeMap, handlers,
-defined = {},
-waiting = {},
-config = {},
-defining = {},
-hasOwn = Object.prototype.hasOwnProperty,
-aps = [].slice,
-jsSuffixRegExp = /\.js$/;
-
-function hasProp(obj, prop) {
-return hasOwn.call(obj, prop);
-}
-
-/**
- * Given a relative module name, like ./something, normalize it to
- * a real name that can be mapped to a path.
- * @param {String} name the relative name
- * @param {String} baseName a real name that the name arg is relative
- * to.
- * @returns {String} normalized name
- */
-function normalize(name, baseName) {
-var nameParts, nameSegment, mapValue, foundMap, lastIndex,
-foundI, foundStarMap, starI, i, j, part,
-baseParts = baseName && baseName.split("/"),
-map = config.map,
-starMap = (map && map['*']) || {};
-
-//Adjust any relative paths.
-if (name && name.charAt(0) === ".") {
-//If have a base name, try to normalize against it,
-//otherwise, assume it is a top-level require that will
-//be relative to baseUrl in the end.
-if (baseName) {
-name = name.split('/');
-lastIndex = name.length - 1;
-
-// Node .js allowance:
-if (config.nodeIdCompat && 
jsSuffixRegExp.test(name[lastIndex])) {
-name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, 
'');
-  

[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am loleaflet/package.json

2020-05-29 Thread gokaysatir (via logerrit)
 loleaflet/Makefile.am  |2 
 loleaflet/js/Autolinker.js | 8455 ++---
 loleaflet/package.json |2 
 3 files changed, 4279 insertions(+), 4180 deletions(-)

New commits:
commit 880868ca6c2630c730f0c003c2078c1eae42c31b
Author: gokaysatir 
AuthorDate: Fri May 29 22:52:50 2020 +0300
Commit: Henry Castro 
CommitDate: Fri May 29 22:13:20 2020 +0200

update autolinker package.

Change-Id: I53c642763212d958fb0a860fcfbd8f4bbe7b37ff
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95166
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index d4126763f..2e43e2df6 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -97,7 +97,7 @@ LOLEAFLET_ADMIN_JS =\
admin/src/AdminSocketHistory.js
 
 NODE_MODULES_SRC =\
-   autolinker@1.4.3 \
+   autolinker@3.14.1 \
json-js@1.1.2 \
select2@4.0.1 \
vex-js@4.1.0 \
diff --git a/loleaflet/js/Autolinker.js b/loleaflet/js/Autolinker.js
index d463c331a..fe7680d03 100644
--- a/loleaflet/js/Autolinker.js
+++ b/loleaflet/js/Autolinker.js
@@ -1,4187 +1,4286 @@
 /*!
  * Autolinker.js
- * 1.4.3
+ * 3.14.1
  *
- * Copyright(c) 2017 Gregory Jacobs 
+ * Copyright(c) 2020 Gregory Jacobs 
  * MIT License
  *
  * https://github.com/gregjacobs/Autolinker.js
  */
-;(function(root, factory) {
-  if (typeof define === 'function' && define.amd) {
-define([], factory);
-  } else if (typeof exports === 'object') {
-module.exports = factory();
-  } else {
-root.Autolinker = factory();
-  }
-}(this, function() {
-/**
- * @class Autolinker
- * @extends Object
- *
- * Utility class used to process a given string of text, and wrap the matches 
in
- * the appropriate anchor (a) tags to turn them into links.
- *
- * Any of the configuration options may be provided in an Object (map) provided
- * to the Autolinker constructor, which will configure how the {@link #link 
link()}
- * method will process the links.
- *
- * For example:
- *
- * var autolinker = new Autolinker( {
- * newWindow : false,
- * truncate  : 30
- * } );
- *
- * var html = autolinker.link( "Joe went to www.yahoo.com" );
- * // produces: 'Joe went to http://www.yahoo.com;>yahoo.com'
- *
- *
- * The {@link #static-link static link()} method may also be used to inline
- * options into a single call, which may be more convenient for one-off uses.
- * For example:
- *
- * var html = Autolinker.link( "Joe went to www.yahoo.com", {
- * newWindow : false,
- * truncate  : 30
- * } );
- * // produces: 'Joe went to http://www.yahoo.com;>yahoo.com'
- *
- *
- * ## Custom Replacements of Links
- *
- * If the configuration options do not provide enough flexibility, a {@link 
#replaceFn}
- * may be provided to fully customize the output of Autolinker. This function 
is
- * called once for each URL/Email/Phone#/Hashtag/Mention (Twitter, Instagram)
- * match that is encountered.
- *
- * For example:
- *
- * var input = "...";  // string with URLs, Email Addresses, Phone #s, 
Hashtags, and Mentions (Twitter, Instagram)
- *
- * var linkedText = Autolinker.link( input, {
- * replaceFn : function( match ) {
- * console.log( "href = ", match.getAnchorHref() );
- * console.log( "text = ", match.getAnchorText() );
- *
- * switch( match.getType() ) {
- * case 'url' :
- * console.log( "url: ", match.getUrl() );
- *
- * if( match.getUrl().indexOf( 'mysite.com' ) === -1 ) {
- * var tag = match.buildTag();  // returns an 
`Autolinker.HtmlTag` instance, which provides mutator methods for easy changes
- * tag.setAttr( 'rel', 'nofollow' );
- * tag.addClass( 'external-link' );
- *
- * return tag;
- *
- * } else {
- * return true;  // let Autolinker perform its normal 
anchor tag replacement
- * }
- *
- * case 'email' :
- * var email = match.getEmail();
- * console.log( "email: ", email );
- *
- * if( email === "my@own.address" ) {
- * return false;  // don't auto-link this particular 
email address; leave as-is
- * } else {
- * return;  // no return value will have Autolinker 
perform its normal anchor tag replacement (same as returning `true`)
- * }
- *
- * case 'phone' :
- * var phoneNumber = match.getPhoneNumber();
- * console.log( phoneNumber );
- *
- * return 'http://newplace.to.link.phone.numbers.to/;>' + phoneNumber + '';
- *
- * case 'hashtag' :
- * 

[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am loleaflet/package.json

2020-05-29 Thread gokaysatir (via logerrit)
 loleaflet/Makefile.am|2 -
 loleaflet/js/sanitize-url.js |   71 +--
 loleaflet/package.json   |2 -
 3 files changed, 38 insertions(+), 37 deletions(-)

New commits:
commit 160acdc5cbb6724874738240a874b77657cf678c
Author: gokaysatir 
AuthorDate: Fri May 29 18:26:47 2020 +0300
Commit: Henry Castro 
CommitDate: Fri May 29 18:13:18 2020 +0200

update sanitize-url package

Change-Id: I4cc68a010f54afc02777c140b28e41c07a0011fe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95158
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 5d96e3940..d4126763f 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -102,7 +102,7 @@ NODE_MODULES_SRC =\
select2@4.0.1 \
vex-js@4.1.0 \
l10n-for-node@0.0.1 \
-   @braintree/sanitize-url@3.0.0
+   @braintree/sanitize-url@4.0.1
 
 LOLEAFLET_CSS =\
$(builddir)/node_modules/select2/dist/css/select2.css \
diff --git a/loleaflet/js/sanitize-url.js b/loleaflet/js/sanitize-url.js
index ee8975589..57ee916b0 100644
--- a/loleaflet/js/sanitize-url.js
+++ b/loleaflet/js/sanitize-url.js
@@ -1,45 +1,46 @@
 (function(f){if(typeof exports==="object"& 
module!=="undefined"){module.exports=f()}else if(typeof 
define==="function"&){define([],f)}else{var g;if(typeof 
window!=="undefined"){g=window}else if(typeof 
global!=="undefined"){g=global}else if(typeof 
self!=="undefined"){g=self}else{g=this}g.sanitizeUrl = f()}})(function(){var 
define,module,exports;return (function(){function r(e,n,t){function 
o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof 
require&if(!f&)return c(i,!0);if(u)return u(i,!0);var a=new 
Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var 
p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return 
o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof 
require&,i=0;i -1;
-}
-
-function sanitizeUrl(url) {
-  if (!url) {
-return 'about:blank';
+  var invalidPrototcolRegex = /^(%20|\s)*(javascript|data)/im;
+  var ctrlCharactersRegex = /[^\x20-\x7EÀ-ž]/gmi;
+  var urlSchemeRegex = /^([^:]+):/gm;
+  var relativeFirstCharacters = ['.', '/'];
+  
+  function isRelativeUrlWithoutProtocol(url) {
+return relativeFirstCharacters.indexOf(url[0]) > -1;
   }
-
-  var urlScheme, urlSchemeParseResults;
-  var sanitizedUrl = url.replace(ctrlCharactersRegex, '');
   
-  if (isRelativeUrl(sanitizedUrl)) {
+  function sanitizeUrl(url) {
+var urlScheme, urlSchemeParseResults, sanitizedUrl;
+  
+if (!url) {
+  return 'about:blank';
+}
+  
+sanitizedUrl = url.replace(ctrlCharactersRegex, '').trim();
+  
+if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
+  return sanitizedUrl;
+}
+  
+urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
+  
+if (!urlSchemeParseResults) {
+  return sanitizedUrl;
+}
+  
+urlScheme = urlSchemeParseResults[0];
+  
+if (invalidPrototcolRegex.test(urlScheme)) {
+  return 'about:blank';
+}
+  
 return sanitizedUrl;
   }
   
-  urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
-
-  if (!urlSchemeParseResults) {
-return 'about:blank';
-  }
-
-  urlScheme = urlSchemeParseResults[0];
-
-  if (invalidPrototcolRegex.test(urlScheme)) {
-return 'about:blank';
-  }
-
-  return sanitizedUrl;
-}
-
-module.exports = {
-  sanitizeUrl: sanitizeUrl
-};
+  module.exports = {
+sanitizeUrl: sanitizeUrl
+  };
 
 },{}]},{},[1])(1)
 });
diff --git a/loleaflet/package.json b/loleaflet/package.json
index a52a754fc..a5655d737 100644
--- a/loleaflet/package.json
+++ b/loleaflet/package.json
@@ -3,7 +3,7 @@
   "version": "0.8.0-dev",
   "description": "LibreOffice online front-end",
   "devDependencies": {
-"@braintree/sanitize-url": "3.0.0",
+"@braintree/sanitize-url": "4.0.1",
 "@types/jquery": "2.0.40",
 "autolinker": "1.4.3",
 "bootstrap": "3.3.6",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-29 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 0914da6ecba31e7eb6031e0d26d6a3692c62894f
Author: Michael Meeks 
AuthorDate: Thu May 28 21:56:11 2020 +0100
Commit: Michael Meeks 
CommitDate: Fri May 29 10:33:08 2020 +0200

Proxy: calm down console debug churn for now.

Change-Id: If31ea5e447e90ad21d07e972eaeb556972b9447a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95066
Tested-by: Jenkins CollaboraOffice 
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 2a789e98e..20757e2a5 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -284,13 +284,13 @@
return this.decoder.decode(this.doSlice(bytes, 
start,end));
};
this.parseIncomingArray = function(arr) {
-   console.debug('proxy: parse incoming array of length ' 
+ arr.length);
+// console.debug('proxy: parse incoming array of length ' 
+ arr.length);
for (var i = 0; i < arr.length; ++i)
{
var left = arr.length - i;
if (left < 4)
{
-   console.debug('no data left');
+// console.debug('no data left');
break;
}
var type = String.fromCharCode(arr[i+0]);
@@ -398,8 +398,8 @@
// too long, hangs, throws, etc. we can recover.
that._setPollInterval(that.maxPollMs);
 
-   console.debug('send msg - ' + that.msgInflight + ' on 
session ' +
- that.sessionId + '  queue: "' + 
that.sendQueue + '"');
+// console.debug('send msg - ' + that.msgInflight + ' on 
session ' +
+//   that.sessionId + '  queue: "' + 
that.sendQueue + '"');
var req = new XMLHttpRequest();
req.open('POST', that.getEndPoint('write'));
req.responseType = 'arraybuffer';
@@ -434,7 +434,7 @@
{
// Throttle.
that.curPollMs = 
Math.min(that.maxPollMs, that.curPollMs * that.throttleFactor) | 0;
-   console.debug('No data for ' + 
timeSinceLastDataMs + ' ms -- throttling to ' + that.curPollMs + ' ms.');
+// console.debug('No data for ' + 
timeSinceLastDataMs + ' ms -- throttling to ' + that.curPollMs + ' ms.');
}
}
 
@@ -480,7 +480,7 @@
// Unless we are backed up.
if (that.msgInflight <= 3)
{
-   console.debug('Have data to send, 
lowering poll interval.');
+// console.debug('Have data to send, 
lowering poll interval.');
that.curPollMs = that.minPollMs;
that._setPollInterval(that.curPollMs);
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-25 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   59 -
 1 file changed, 53 insertions(+), 6 deletions(-)

New commits:
commit 9fd905563b9d2949263f8b7913375d8833662784
Author: Michael Meeks 
AuthorDate: Mon May 25 20:44:31 2020 +0100
Commit: Michael Meeks 
CommitDate: Mon May 25 22:17:12 2020 +0200

Proxy: horrible re-implementation of array / string bits for IE11.

Change-Id: Iccb2f98b5529a2f923dba8763b17f895067c1e0c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94808
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index a0d719eb3..2a789e98e 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -235,8 +235,55 @@
};
this.onmessage = function() {
};
+   // IE11 compatibility ...
+   if (!!window.MSInputMethodContext && !!document.documentMode) {
+   this.decoder = {};
+   this.decoder.decode = function(bytes) {
+   var decoded = '';
+   var code = 0;
+   for (var i = 0; i < bytes.length;) {
+   var b = bytes[i];
+   var seqLen = 1;
+   // get bits off the top.
+   if (b <= 0x7f)
+   code = b & 0xff;
+   else if (b <= 0xdf) {
+   code = b & 0x1f;
+   seqLen = 2;
+   } else if (b <= 0xdf) {
+   code = b & 0x0f;
+   seqLen = 3;
+   } else if (b <= 0xf4) {
+   code = b & 0x07;
+   seqLen = 4;
+   }
+   var left = bytes.length - i;
+   if (left >= seqLen) {
+   for (var j = 1; j < seqLen; ++j)
+   code = (code << 6) | 
(bytes[i + j] & 0x3f);
+   } else { // skip to end
+   seqLen = left;
+   code = 0xfffd;
+   }
+   decoded += String.fromCharCode(code);
+   i += seqLen;
+   }
+   return decoded;
+   };
+   this.doSlice = function(bytes,start,end) {
+   var data = new Uint8Array(end - start + 1);
+   for (var i = 0; i <= (end - start); ++i)
+   data[i] = bytes[start + i];
+   return data;
+   };
+   } else {
+   this.decoder = new TextDecoder();
+   this.doSlice = function(bytes,start,end) { return 
bytes.slice(start,end); };
+   }
+   this.decode = function(bytes,start,end) {
+   return this.decoder.decode(this.doSlice(bytes, 
start,end));
+   };
this.parseIncomingArray = function(arr) {
-   var decoder = new TextDecoder();
console.debug('proxy: parse incoming array of length ' 
+ arr.length);
for (var i = 0; i < arr.length; ++i)
{
@@ -265,7 +312,7 @@
var start = i;
while (arr[i] != 10) // '\n'
i++;
-   numStr = decoder.decode(arr.slice(start, i)); 
// FIXME: IE11
+   numStr = this.decode(arr, start, i);
var serial = parseInt(numStr, 16);
 
i++; // skip \n
@@ -280,16 +327,16 @@
start = i;
while (arr[i] != 10) // '\n'
i++;
-   numStr = decoder.decode(arr.slice(start, i)); 
// FIXME: IE11
+   numStr = this.decode(arr, start, i);
var size = parseInt(numStr, 16);
 
i++; // skip \n
 
var data;
-   if (type == 'T') // FIXME: IE11

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

2020-05-22 Thread Ashod Nakashian (via logerrit)
 loleaflet/js/global.js |   83 ++---
 1 file changed, 79 insertions(+), 4 deletions(-)

New commits:
commit ddc85b24f98cd8b0f35f479fade79f855e61dea9
Author: Ashod Nakashian 
AuthorDate: Thu May 21 21:22:10 2020 -0400
Commit: Jan Holesovsky 
CommitDate: Fri May 22 17:50:15 2020 +0200

leaflet: smart throttling of RichProxy polling

When there is no data coming in from WSD, we slow
down the frequency of invoking RichProxy.

Supports recovering from errors and server restarts
or document unloading (i.e. when the session is
invalid).

We don't invoke RichProxy more than 40 times a second
(i.e. with 25ms interval) and we slow down when
the last data was received 3x longer than the
polling interval. The current decay rate is 15%.
That is, we throttle to 1.15x the last interval.
This brings us down from 25ms to 500ms in about
4 seconds, which is very reasonable.

However, when we want to send data, or when we do
receive any data, we immediately maximize the
frequency so we can communicate as fast as possible
and reduce the user-visible latency. Notice that
when we get some data (without having sent anything
recently) it implies activity from another user,
so we do want to get their changes in real-time.
This is why we reduce the polling frequency
gradually, but increase it abruptly.

The parameters of the algorithm are configurable
directly in the code, but the current defaults are
very reasonable.

Change-Id: I0b9fd6db73caa35853fe6d8077bef66934de679c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94654
Tested-by: Jenkins CollaboraOffice 
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 373d1635e..a0d719eb3 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -223,6 +223,12 @@
this.msgInflight = 0;
this.inSerial = 0;
this.outSerial = 0;
+   this.minPollMs = 25; // Anything less than ~25 ms can overwhelm 
the HTTP server.
+   this.maxPollMs = 500; // We can probably go as much as 1-2 
seconds without ill-effect.
+   this.curPollMs = this.minPollMs; // The current poll period.
+   this.minIdlePollsToThrottle = 3; // This many 'no data' 
responses and we throttle.
+   this.throttleFactor = 1.15; // How rapidly to throttle. 15% 
takes 4s to go from 25 to 500ms.
+   this.lastDataTimestamp = performance.now(); // The last time we 
got any data.
this.onclose = function() {
};
this.onerror = function() {
@@ -306,17 +312,45 @@
}
this.readyState = 3; // CLOSED
};
+   this._setPollInterval = function(intervalMs) {
+   clearInterval(that.pollInterval);
+   that.pollInterval = setInterval(that.doSend, 
intervalMs);
+   },
this.doSend = function () {
if (that.sessionId === 'open')
{
-   console.debug('new session not completed');
+   if (that.readyState === 3)
+   {
+   console.debug('Session closed, opening 
a new one.');
+   that.getSessionId();
+   }
+   else
+   console.debug('New session not 
completed.');
+
return;
}
+
if (that.msgInflight >= 4) // something went badly 
wrong.
{
-   console.debug('High latency connection - too 
much in-flight, pausing');
+   // We shouldn't get here because we throttle 
sending when we
+   // have something in flight, but if the server 
hangs, we
+   // will do up to 3 retries before we end up 
here and yield.
+   if (that.curPollMs < that.maxPollMs)
+   {
+   that.curPollMs = 
Math.min(that.maxPollMs, that.curPollMs * that.throttleFactor) | 0;
+   console.debug('High latency connection 
- too much in-flight, throttling to ' + that.curPollMs + ' ms.');
+   that._setPollInterval(that.curPollMs);
+   }
+   else
+   console.debug('High latency connection 
- too much in-flight, pausing.');
return;
   

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

2020-05-21 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit ec48b7c746110a5779ec505ed1ba4700222c62d3
Author: Michael Meeks 
AuthorDate: Thu May 21 21:25:34 2020 +0100
Commit: Michael Meeks 
CommitDate: Thu May 21 23:02:39 2020 +0200

Proxy: handle connection failure during session gracefully.

Change-Id: Ib8bda31352de6fea406b32b86bc134ee2a7841d8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94652
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 6cc75b7b5..373d1635e 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -295,6 +295,17 @@
}
};
this.sendQueue = '';
+   this._signalErrorClose = function() {
+   if (that.readyState < 3)
+   {
+   this.onerror();
+   this.onclose();
+   clearInterval(this.waitInterval);
+   this.waitInterval = undefined;
+   this.sessionId = 'open';
+   }
+   this.readyState = 3; // CLOSED
+   };
this.doSend = function () {
if (that.sessionId === 'open')
{
@@ -315,7 +326,10 @@
if (this.status == 200)
that.parseIncomingArray(new 
Uint8Array(this.response));
else
-   console.debug('proxy: error on incoming 
response');
+   {
+   console.debug('proxy: error on incoming 
response ' + this.status);
+   that._signalErrorClose();
+   }
});
req.addEventListener('loadend', function() {
that.msgInflight--;
@@ -333,9 +347,7 @@
if (this.responseText.indexOf('\n') >= 0)
{
console.debug('Error: failed to fetch 
session id!');
-   that.onerror();
-   that.onclose();
-   that.readyState = 3;
+   that._signalErrorClose();
}
else
{
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-20 Thread Ashod Nakashian (via logerrit)
 loleaflet/js/global.js |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c9be6b4a30871c569a7d6a1a5ba6b18dc670111e
Author: Ashod Nakashian 
AuthorDate: Mon May 18 23:26:35 2020 -0400
Commit: Andras Timar 
CommitDate: Wed May 20 16:45:30 2020 +0200

leaflet: restore reuse_cookies to the url

Reuse cookies are captured on file-serving the
loleaflet.html, whereupon they are injected
into it before serving as part of the document
load url. They show up as _cookies=
in the url embedded in loleaflet.html.
When loading the document, and creating
the session, the cookies received via
reuse_cookies is stored and set in each
WOPI http invocation.

This restores creating reuse_cookies in the
URL. It was inadvertently dropped after some cleanup.

Change-Id: I6de8ddb58e7f43566a08c22327dbc4b7a1207388
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94472
Tested-by: Andras Timar 
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index c867d28ff..6cc75b7b5 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -519,6 +519,9 @@
else if (global.accessHeader !== '') {
wopiParams = { 'access_header': global.accessHeader };
}
+   else if (global.reuseCookies !== '') {
+   wopiParams = { 'reuse_cookies': global.reuseCookies };
+   }
if (wopiParams) {
docParams = Object.keys(wopiParams).map(function(key) {
return encodeURIComponent(key) + '=' + 
encodeURIComponent(wopiParams[key]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-13 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   69 +++--
 1 file changed, 27 insertions(+), 42 deletions(-)

New commits:
commit 6ba706662739cc9ef029c13aef86d894ff371a37
Author: Michael Meeks 
AuthorDate: Wed May 13 17:21:07 2020 +0100
Commit: Michael Meeks 
CommitDate: Wed May 13 19:48:31 2020 +0200

Proxy: significantly simplify proxy socket.

This avoids needing long-term wait sockets which consume server-side
resources & can block other requests.

Change-Id: I0909f49e16c5ce2315b9980cdf34fa4e370e3abc
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94150
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index f0556a5fb..279f2b7c9 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -220,7 +220,7 @@
this.sessionId = 'open';
this.id = window.proxySocketCounter++;
this.sendCounter = 0;
-   this.readWaiting = 0;
+   this.msgInflight = 0;
this.inSerial = 0;
this.outSerial = 0;
this.onclose = function() {
@@ -295,26 +295,34 @@
}
};
this.sendQueue = '';
-   this.sendTimeout = undefined;
this.doSend = function () {
-   console.debug('send msg "' + that.sendQueue + '"');
-   var req = new XMLHttpRequest();
-   req.open('POST', that.getEndPoint('write'));
if (that.sessionId === 'open')
+   {
console.debug('new session not completed');
-   else
+   return;
+   }
+   if (that.msgInflight >= 4) // something went badly 
wrong.
{
-   req.responseType = 'arraybuffer';
-   req.addEventListener('load', function() {
-   if (this.status == 200)
-   that.parseIncomingArray(new 
Uint8Array(this.response));
-   else
-   console.debug('proxy: error on 
incoming response');
-   });
+   console.debug('High latency connection - too 
much in-flight, pausing');
+   return;
}
+   console.debug('send msg - ' + that.msgInflight + ' on 
session ' +
+ that.sessionId + '  queue: "' + 
that.sendQueue + '"');
+   var req = new XMLHttpRequest();
+   req.open('POST', that.getEndPoint('write'));
+   req.responseType = 'arraybuffer';
+   req.addEventListener('load', function() {
+   if (this.status == 200)
+   that.parseIncomingArray(new 
Uint8Array(this.response));
+   else
+   console.debug('proxy: error on incoming 
response');
+   });
+   req.addEventListener('loadend', function() {
+   that.msgInflight--;
+   });
req.send(that.sendQueue);
that.sendQueue = '';
-   that.sendTimeout = undefined;
+   that.msgInflight++;
};
this.getSessionId = function() {
var req = new XMLHttpRequest();
@@ -343,8 +351,6 @@
'B0x' + this.outSerial.toString(16) + '\n' +
'0x' + msg.length.toString(16) + '\n' + msg + 
'\n');
this.outSerial++;
-   if (this.sessionId !== 'open' && this.sendTimeout === 
undefined)
-   this.sendTimeout = setTimeout(this.doSend, 2 /* 
ms */);
};
this.sendCloseMsg = function(beacon) {
var url = that.getEndPoint('close');
@@ -378,32 +384,11 @@
// queue fetch of session id.
this.getSessionId();
 
-   // horrors ...
-   this.waitConnect = function() {
-   console.debug('proxy: waiting - ' + that.readWaiting + 
' on session ' + that.sessionId);
-   if (that.readWaiting >= 4) // max 4 waiting connections 
concurrently.
-   return;
-   if (that.sessionId == 'open')
-   return; // waiting for our session id.
-   var req = new XMLHttpRequest();
- 

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

2020-04-30 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit e9abaaf71b23809fe96c5475030363d623b753a3
Author: Michael Meeks 
AuthorDate: Thu Apr 30 16:29:26 2020 +0100
Commit: Michael Meeks 
CommitDate: Thu Apr 30 19:01:46 2020 +0200

Proxy: tolerate missing CSS files during CSS re-write.

Change-Id: I3d5af4950962391466192fdb391915d02f8813ed
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93221
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 07ae23ad9..c5546f7c2 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -402,7 +402,13 @@
relBases.pop(); // bin last - css name.
var replaceBase = 'url("' + relBases.join('/') 
+ '/images/';
 
-   var rules = sheets[i].cssRules || 
sheets[i].rules;
+   var rules;
+   try {
+   rules = sheets[i].cssRules || 
sheets[i].rules;
+   } catch (err) {
+   console.log('Missing CSS from ' + 
sheets[i].href);
+   continue;
+   }
for (var r = 0; r < rules.length; ++r) {
if (!rules[r] || !rules[r].style)
continue;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/js wsd/FileServer.cpp

2020-04-28 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |2 -
 wsd/FileServer.cpp |   89 +
 2 files changed, 55 insertions(+), 36 deletions(-)

New commits:
commit d439f8098d2fbec7ace4fa6a66f7c9c00d77edfe
Author: Michael Meeks 
AuthorDate: Tue Apr 28 18:05:25 2020 +0100
Commit: Michael Meeks 
CommitDate: Tue Apr 28 19:34:15 2020 +0200

Proxy: improving parsing & URL passing for websocket to fix connect-src.

Change-Id: Id017c46e755eb14bc25d18be450b6100ff6bed92
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93094
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index c3c8343ad..c2935ab96 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -344,7 +344,7 @@
};
this.getEndPoint = function(type) {
var base = this.uri;
-   return base.replace(/^ws/, 'http') + '/' + type + '/' + 
this.outSerial;
+   return base + '/' + type + '/' + this.outSerial;
};
console.debug('proxy: new socket ' + this.id + ' ' + this.uri);
 
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 99ac332b3..888509591 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -641,44 +641,62 @@ constexpr char BRANDING_UNSUPPORTED[] = 
"branding-unsupported";
 #endif
 
 namespace {
-// The user can override the ServerRoot with a new prefix.
-std::string getResponseRoot(const HTTPRequest )
-{
-if (!request.has("ProxyPrefix"))
-return LOOLWSD::ServiceRoot;
-std::string proxyPrefix = request.get("ProxyPrefix", "");
-
-// skip url to the root path.
-size_t pos = proxyPrefix.find("://");
-if (pos != std::string::npos) {
-pos = proxyPrefix.find("/", pos + 3);
-if (pos != std::string::npos)
-proxyPrefix = proxyPrefix.substr(pos);
-else
-LOG_DBG("Unusual proxy prefix '" << proxyPrefix << "'");
-} else
-LOG_DBG("No http[s]:// in unusual proxy prefix '" << proxyPrefix);
-return proxyPrefix;
-}
+/// Very simple splitting of proxy URLs without fear of escaping or 
validation.
+class ProxyURL {
+std::string _schemeAuthority;
+std::string _pathPlus;
+public:
+ProxyURL(const HTTPRequest )
+{
+// The user can override the ServerRoot with a new prefix.
+if (_pathPlus.size() <= 0)
+_pathPlus = LOOLWSD::ServiceRoot;
 
-std::string getWebSocketUrl(const HTTPRequest )
-{
-bool ssl = (LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination());
-std::string proxyPrefix = request.get("ProxyPrefix", "");
-std::string serverName = LOOLWSD::ServerName.empty() ? 
request.getHost() : LOOLWSD::ServerName;
-if (proxyPrefix.size() > 0)
+if (_schemeAuthority.size() <= 0)
+{
+bool ssl = (LOOLWSD::isSSLEnabled() || 
LOOLWSD::isSSLTermination());
+std::string serverName = LOOLWSD::ServerName.empty() ? 
request.getHost() : LOOLWSD::ServerName;
+_schemeAuthority = (ssl ? "wss://" : "ws://") + serverName;
+}
+
+// A well formed ProxyPrefix will override it.
+std::string url = request.get("ProxyPrefix", "");
+if (url.size() <= 0)
+return;
+
+size_t pos = url.find("://");
+if (pos != std::string::npos) {
+pos = url.find("/", pos + 3);
+if (pos != std::string::npos)
+{
+_schemeAuthority = url.substr(0, pos);
+_pathPlus = url.substr(pos);
+return;
+}
+else
+LOG_ERR("Unusual proxy prefix '" << url << "'");
+} else
+LOG_ERR("No http[s]:// in unusual proxy prefix '" << url << 
"'");
+
+}
+
+std::string getResponseRoot() const
 {
-ssl = !strcmp(proxyPrefix.c_str(), "https://;);
-serverName = request.getHost();
+return _pathPlus;
 }
-return (ssl ? "wss://" : "ws://") + serverName;
-}
+
+std::string getWebSocketUrl() const
+{
+return _schemeAuthority;
+}
+};
 }
 
 void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, 
Poco::MemoryInputStream& message,
   const 
std::shared_ptr& socket)
 {
-const auto host = getWebSocketUrl(request);
+ProxyURL cnxDetails(request);
+
 const Poco::URI::QueryParameters params = 
Poco::URI(request.getURI()).getQueryParameters();
 
 // Is this a file we read at startup - if not; its not for serving.
@@ -725,12 +743,12 @@ void 

[Libreoffice-commits] online.git: loleaflet/js wsd/LOOLWSD.cpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |2 +-
 wsd/LOOLWSD.cpp|4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5c4981794f33b15ed313554590b4fa9a05b0ffcc
Author: Michael Meeks 
AuthorDate: Sat Apr 18 21:24:41 2020 +0100
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 20:57:19 2020 +0200

Proxy: adapt the path with a serial for each request.

Helps to debug, and avoids the webserver getting unhappy.

Change-Id: I632550f2ad26eef973cd036422f9f1a73d0f0764
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92817
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 640da1e3f..1e09a86e0 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -334,7 +334,7 @@
};
this.getEndPoint = function(type) {
var base = this.uri;
-   return base.replace(/^ws/, 'http') + '/' + type;
+   return base.replace(/^ws/, 'http') + '/' + type + '/' + 
this.outSerial;
};
console.debug('proxy: new socket ' + this.id + ' ' + this.uri);
 
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index ba1d83c77..38496b184 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2343,8 +2343,8 @@ private:
 //Util::dumpHex(std::cerr, "clipboard:\n", "", 
socket->getInBuffer()); // lots of data ...
 handleClipboardRequest(request, message, disposition, 
socket);
 }
-else if (request.has("ProxyPrefix") && reqPathTokens.count() > 
2 &&
- (reqPathTokens[reqPathTokens.count()-2] == "ws"))
+else if (request.has("ProxyPrefix") && reqPathTokens.count() > 
3 &&
+ (reqPathTokens[reqPathTokens.count()-3] == "ws"))
 {
 std::string decodedUri; // WOPISrc
 Poco::URI::decode(reqPathTokens[1], decodedUri);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/js wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   32 +---
 wsd/ProxyProtocol.cpp  |   25 ++---
 wsd/ProxyProtocol.hpp  |   14 ++
 3 files changed, 61 insertions(+), 10 deletions(-)

New commits:
commit b4feecde2d70a853cdc18edd8816a45ad8c87e29
Author: Michael Meeks 
AuthorDate: Sat Apr 18 18:40:59 2020 +0100
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 20:42:05 2020 +0200

Proxy: marshal message serial too.

Change-Id: I23a28fe052062a0b98bbb2828b71ab8de6f1459c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92816
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index cc1ab2090..640da1e3f 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -208,6 +208,8 @@
this.id = window.proxySocketCounter++;
this.sendCounter = 0;
this.readWaiting = 0;
+   this.inSerial = 0;
+   this.outSerial = 0;
this.onclose = function() {
};
this.onerror = function() {
@@ -231,17 +233,35 @@
console.debug('wrong data type: ' + 
type);
break;
}
-   if (arr[i+1] !== 48 && arr[i+2] !== 120) // '0x'
+   i++;
+
+   // Serial
+   if (arr[i] !== 48 && arr[i+1] !== 120) // '0x'
{
console.debug('missing hex preamble');
break;
}
-   i += 3;
+   i += 2;
var numStr = '';
var start = i;
while (arr[i] != 10) // '\n'
i++;
numStr = decoder.decode(arr.slice(start, i)); 
// FIXME: IE11
+   var serial = parseInt(numStr, 16);
+
+   i++; // skip \n
+
+   // Size:
+   if (arr[i] !== 48 && arr[i+1] !== 120) // '0x'
+   {
+   console.debug('missing hex preamble');
+   break;
+   }
+   i += 2;
+   start = i;
+   while (arr[i] != 10) // '\n'
+   i++;
+   numStr = decoder.decode(arr.slice(start, i)); 
// FIXME: IE11
var size = parseInt(numStr, 16);
 
i++; // skip \n
@@ -252,6 +272,10 @@
else
data = arr.slice(i, i + size);
 
+   if (serial !== that.inSerial + 1) {
+   console.debug('Error: serial mismatch ' 
+ serial + ' vs. ' + (that.inSerial + 1));
+   }
+   that.inSerial = serial;
this.onmessage({ data: data });
 
i += size; // skip trailing '\n' in 
loop-increment
@@ -295,7 +319,9 @@
};
this.send = function(msg) {
this.sendQueue = this.sendQueue.concat(
-   'B0x' + msg.length.toString(16) + '\n' + msg + 
'\n');
+   'B0x' + this.outSerial.toString(16) + '\n' +
+   '0x' + msg.length.toString(16) + '\n' + msg + 
'\n');
+   this.outSerial++;
if (this.sessionId !== 'fetchsession' && 
this.sendTimeout === undefined)
this.sendTimeout = setTimeout(this.doSend, 2 /* 
ms */);
};
diff --git a/wsd/ProxyProtocol.cpp b/wsd/ProxyProtocol.cpp
index c8a259abe..973d9f3c5 100644
--- a/wsd/ProxyProtocol.cpp
+++ b/wsd/ProxyProtocol.cpp
@@ -97,21 +97,37 @@ bool ProxyProtocolHandler::parseEmitIncoming(
 
 while (in.size() > 0)
 {
-if (in[0] != 'T' && in[0] != 'B')
+// Type
+if ((in[0] != 'T' && in[0] != 'B') || in.size() < 2)
 {
 LOG_ERR("Invalid message type " << in[0]);
 return false;
 }
 auto it = in.begin() + 1;
+
+// Serial
 for (; it != in.end() && *it != '\n'; ++it);
 *it = '\0';
-uint64_t len = strtoll( [1], nullptr, 16 );
+uint64_t serial = strtoll( [1], nullptr, 16 );
+in.erase(in.begin(), it + 1);
+if (in.size() < 2)
+{
+

[Libreoffice-commits] online.git: loleaflet/js net/Socket.cpp wsd/ProxyProtocol.cpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |4 ++--
 net/Socket.cpp |1 -
 wsd/ProxyProtocol.cpp  |7 +++
 3 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 6e7977bbb8396f205a3f3e697a81d00a5e835f83
Author: Michael Meeks 
AuthorDate: Tue Apr 14 17:01:41 2020 +0100
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 19:55:00 2020 +0200

Proxy: improve debugging and connection handling.

Change-Id: I1d48c4ec7fb80eaab1aabc83b0c210b7cf138ef2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92815
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index aacf59496..cc1ab2090 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -260,7 +260,6 @@
this.sendQueue = '';
this.sendTimeout = undefined;
this.doSend = function () {
-   that.sendTimeout = undefined;
console.debug('send msg "' + that.sendQueue + '"');
var req = new XMLHttpRequest();
req.open('POST', that.getEndPoint('write'));
@@ -279,6 +278,7 @@
}
req.send(that.sendQueue);
that.sendQueue = '';
+   that.sendTimeout = undefined;
};
this.getSessionId = function() {
var req = new XMLHttpRequest();
@@ -318,7 +318,7 @@
// horrors ...
this.waitConnect = function() {
console.debug('proxy: waiting - ' + that.readWaiting + 
' on session ' + that.sessionId);
-   if (that.readWaiting > 4) // max 4 waiting connections 
concurrently.
+   if (that.readWaiting >= 4) // max 4 waiting connections 
concurrently.
return;
if (that.sessionId == 'fetchsession')
return; // waiting for our session id.
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 24041bc4b..0b7a2f2ff 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -219,7 +219,6 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
 timeout.tv_sec = timeoutMaxMicroS / (1000 * 1000);
 timeout.tv_nsec = (timeoutMaxMicroS % (1000 * 1000)) * 1000;
 rc = ::ppoll(&_pollFds[0], size + 1, , nullptr);
-LOG_TRC("ppoll result " << rc << " errno " << strerror(errno));
 #  else
 int timeoutMaxMs = (timeoutMaxMicroS + ) / 1000;
 LOG_TRC("Legacy Poll start, timeoutMs: " << timeoutMaxMs);
diff --git a/wsd/ProxyProtocol.cpp b/wsd/ProxyProtocol.cpp
index 3ed43e979..c8a259abe 100644
--- a/wsd/ProxyProtocol.cpp
+++ b/wsd/ProxyProtocol.cpp
@@ -219,6 +219,13 @@ void ProxyProtocolHandler::getIOStats(uint64_t , 
uint64_t )
 void ProxyProtocolHandler::dumpState(std::ostream& os)
 {
 os << "proxy protocol sockets: " << _outSockets.size() << " writeQueue: " 
<< _writeQueue.size() << ":\n";
+os << "\t";
+for (auto  : _outSockets)
+{
+auto sock = it.lock();
+os << "#" << (sock ? sock->getFD() : -2) << " ";
+}
+os << "\n";
 for (auto it : _writeQueue)
 Util::dumpHex(os, "\twrite queue entry:", "\t\t", *it);
 if (_msgHandler)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/js wsd/LOOLWSD.cpp wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   20 +---
 wsd/LOOLWSD.cpp|2 +-
 wsd/ProxyProtocol.cpp  |   48 +++-
 wsd/ProxyProtocol.hpp  |3 ++-
 4 files changed, 47 insertions(+), 26 deletions(-)

New commits:
commit 01519bdc644781cb66a2179dfe40343bf9769b84
Author: Michael Meeks 
AuthorDate: Sat Mar 21 15:07:10 2020 +
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 16:44:55 2020 +0200

Proxy: improve debugging & naming.

Change-Id: Ifba669a33855a67c9a4e968db42ef1a2cb301d63
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92813
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index c711c84b0..aacf59496 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -216,7 +216,7 @@
};
this.parseIncomingArray = function(arr) {
var decoder = new TextDecoder();
-   console.debug('Parse incoming array of length ' + 
arr.length);
+   console.debug('proxy: parse incoming array of length ' 
+ arr.length);
for (var i = 0; i < arr.length; ++i)
{
var left = arr.length - i;
@@ -274,7 +274,7 @@
if (this.status == 200)
that.parseIncomingArray(new 
Uint8Array(this.response));
else
-   console.debug('Error on 
incoming response');
+   console.debug('proxy: error on 
incoming response');
});
}
req.send(that.sendQueue);
@@ -300,21 +300,24 @@
this.sendTimeout = setTimeout(this.doSend, 2 /* 
ms */);
};
this.close = function() {
-   console.debug('close socket');
+   console.debug('proxy: close socket');
this.readyState = 3;
this.onclose();
+   clearInterval(this.waitInterval);
+   this.waitInterval = undefined;
};
this.getEndPoint = function(type) {
var base = this.uri;
return base.replace(/^ws/, 'http') + '/' + type;
};
-   console.debug('New proxy socket ' + this.id + ' ' + this.uri);
+   console.debug('proxy: new socket ' + this.id + ' ' + this.uri);
 
// queue fetch of session id.
this.getSessionId();
 
// horrors ...
-   this.readInterval = setInterval(function() {
+   this.waitConnect = function() {
+   console.debug('proxy: waiting - ' + that.readWaiting + 
' on session ' + that.sessionId);
if (that.readWaiting > 4) // max 4 waiting connections 
concurrently.
return;
if (that.sessionId == 'fetchsession')
@@ -329,13 +332,16 @@
});
req.addEventListener('loadend', function() {
that.readWaiting--;
+   console.debug('proxy: wait ended, re-issue');
+   that.waitConnect();
});
-   req.open('GET', that.getEndPoint('read'));
+   req.open('GET', that.getEndPoint('wait'));
req.setRequestHeader('SessionId', that.sessionId);
req.responseType = 'arraybuffer';
req.send('');
that.readWaiting++;
-   }, 250);
+   };
+   this.waitInterval = setInterval(this.waitConnect, 250);
};
 
if (global.socketProxy)
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index ef7c01c2a..ba1d83c77 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2943,7 +2943,7 @@ private:
 none, url, docKey, _id, uriPublic);
 
 std::string fullURL = request.getURI();
-std::string ending = "/ws/read";
+std::string ending = "/ws/wait";
 bool isWaiting = (fullURL.size() > ending.size() &&
   std::equal(ending.rbegin(), ending.rend(), 
fullURL.rbegin()));
 if (docBroker)
diff --git a/wsd/ProxyProtocol.cpp b/wsd/ProxyProtocol.cpp
index c8f578559..89b3d9ba9 100644
--- a/wsd/ProxyProtocol.cpp
+++ b/wsd/ProxyProtocol.cpp
@@ -31,7 +31,7 @@ void DocumentBroker::handleProxyRequest(
 std::shared_ptr clientSession;
 if (sessionId == "fetchsession")
 {
-LOG_TRC("Create session for " << _docKey);
+LOG_TRC("proxy: Create 

[Libreoffice-commits] online.git: loleaflet/js wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |1 +
 wsd/ProxyProtocol.cpp  |9 +
 wsd/ProxyProtocol.hpp  |6 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 8c98b5930f2a15cda2d5827a719ec49598e3ac5e
Author: Michael Meeks 
AuthorDate: Fri Mar 20 20:45:38 2020 +
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 16:12:01 2020 +0200

Proxy: poll for output space if we need waking.

Change-Id: I18a5e71bd3342eea7992672d9be1f5518ea008e3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92810
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 0739681a2..c711c84b0 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -216,6 +216,7 @@
};
this.parseIncomingArray = function(arr) {
var decoder = new TextDecoder();
+   console.debug('Parse incoming array of length ' + 
arr.length);
for (var i = 0; i < arr.length; ++i)
{
var left = arr.length - i;
diff --git a/wsd/ProxyProtocol.cpp b/wsd/ProxyProtocol.cpp
index 25602f146..6279682f2 100644
--- a/wsd/ProxyProtocol.cpp
+++ b/wsd/ProxyProtocol.cpp
@@ -219,6 +219,15 @@ void ProxyProtocolHandler::dumpState(std::ostream& os)
 Util::dumpHex(os, "\twrite queue entry:", "\t\t", *it);
 }
 
+int ProxyProtocolHandler::getPollEvents(std::chrono::steady_clock::time_point 
/* now */,
+int64_t &/* timeoutMaxMs */)
+{
+int events = POLLIN;
+if (_msgHandler && _msgHandler->hasQueuedMessages())
+events |= POLLOUT;
+return events;
+}
+
 void ProxyProtocolHandler::performWrites()
 {
 if (_msgHandler)
diff --git a/wsd/ProxyProtocol.hpp b/wsd/ProxyProtocol.hpp
index af1394164..a2b98c62d 100644
--- a/wsd/ProxyProtocol.hpp
+++ b/wsd/ProxyProtocol.hpp
@@ -34,11 +34,7 @@ public:
 void handleIncomingMessage(SocketDisposition &/* disposition */) override;
 
 int getPollEvents(std::chrono::steady_clock::time_point /* now */,
-  int64_t &/* timeoutMaxMs */) override
-{
-// underlying buffer based polling is fine.
-return POLLIN;
-}
+  int64_t &/* timeoutMaxMs */) override;
 
 void checkTimeout(std::chrono::steady_clock::time_point /* now */) override
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/js wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   12 +++-
 wsd/DocumentBroker.hpp |3 ++-
 wsd/LOOLWSD.cpp|   12 +---
 wsd/ProxyProtocol.cpp  |   42 +++---
 wsd/ProxyProtocol.hpp  |7 ++-
 5 files changed, 47 insertions(+), 29 deletions(-)

New commits:
commit c28fff4cfa3fb37a887db2656dd535760e5a0a86
Author: Michael Meeks 
AuthorDate: Fri Mar 20 20:15:08 2020 +
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 15:58:42 2020 +0200

Proxy: open four wait sockets concurrently.

Change-Id: I08b85677be528b7aa77272a8527c9bacf3f7c336
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92809
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 023a8bf7c..0739681a2 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -207,7 +207,7 @@
this.sessionId = 'fetchsession';
this.id = window.proxySocketCounter++;
this.sendCounter = 0;
-   this.readWaiting = false;
+   this.readWaiting = 0;
this.onclose = function() {
};
this.onerror = function() {
@@ -314,9 +314,9 @@
 
// horrors ...
this.readInterval = setInterval(function() {
-   if (this.readWaiting) // one at a time for now
+   if (that.readWaiting > 4) // max 4 waiting connections 
concurrently.
return;
-   if (this.sessionId == 'fetchsession')
+   if (that.sessionId == 'fetchsession')
return; // waiting for our session id.
var req = new XMLHttpRequest();
// fetch session id:
@@ -325,13 +325,15 @@
that.parseIncomingArray(new 
Uint8Array(this.response));
else
console.debug('Handle error ' + 
this.status);
-   that.readWaiting = false;
+   });
+   req.addEventListener('loadend', function() {
+   that.readWaiting--;
});
req.open('GET', that.getEndPoint('read'));
req.setRequestHeader('SessionId', that.sessionId);
req.responseType = 'arraybuffer';
req.send('');
-   that.readWaiting = true;
+   that.readWaiting++;
}, 250);
};
 
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 4e854d3fb..6e265c3dc 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -147,7 +147,8 @@ public:
 const Poco::URI& uriPublic,
 const bool isReadOnly,
 const std::string& hostNoTrust,
-const std::shared_ptr );
+const std::shared_ptr ,
+bool isWaiting);
 
 /// Thread safe termination of this broker if it has a lingering thread
 void joinThread();
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 7607facef..ef7c01c2a 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2941,11 +2941,16 @@ private:
 // Request a kit process for this doc.
 std::shared_ptr docBroker = findOrCreateDocBroker(
 none, url, docKey, _id, uriPublic);
+
+std::string fullURL = request.getURI();
+std::string ending = "/ws/read";
+bool isWaiting = (fullURL.size() > ending.size() &&
+  std::equal(ending.rbegin(), ending.rend(), 
fullURL.rbegin()));
 if (docBroker)
 {
 // need to move into the DocumentBroker context before doing 
session lookup / creation etc.
 std::string id = _id;
-disposition.setMove([docBroker, id, uriPublic, isReadOnly, 
hostNoTrust, sessionId]
+disposition.setMove([docBroker, id, uriPublic, isReadOnly, 
hostNoTrust, sessionId, isWaiting]
 (const std::shared_ptr )
 {
 LOG_TRC("Setting up docbroker thread for " << 
docBroker->getDocKey());
@@ -2955,7 +2960,8 @@ private:
 // We no longer own this socket.
 moveSocket->setThreadOwner(std::thread::id());
 
-docBroker->addCallback([docBroker, id, uriPublic, 
isReadOnly, hostNoTrust, sessionId, moveSocket]()
+docBroker->addCallback([docBroker, id, uriPublic, 
isReadOnly, hostNoTrust,
+sessionId, moveSocket, isWaiting]()
 {
 // Now inside the document broker thread ...
 LOG_TRC("In the docbroker thread for " << 
docBroker->getDocKey());
@@ -2965,7 +2971,7 @@ private:

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

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   79 ++---
 1 file changed, 36 insertions(+), 43 deletions(-)

New commits:
commit 3f9b486903622538ea11762d95402567772a0e0c
Author: Michael Meeks 
AuthorDate: Fri Mar 20 16:38:14 2020 +
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 14:25:48 2020 +0200

Proxy: send multiple messages in a single request.

Change-Id: Ic0a303979478801bd23941e8893ce5721cf3e732
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92807
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index eba6852b8..f5c038b91 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -196,6 +196,7 @@
 
global.proxySocketCounter = 0;
global.ProxySocket = function (uri) {
+   var that = this;
this.uri = uri;
this.binaryType = 'arraybuffer';
this.bufferedAmount = 0;
@@ -255,56 +256,48 @@
i += size; // skip trailing '\n' in 
loop-increment
}
};
-   this.parseIncoming = function(type, msg) {
-   if (type === 'blob')
-   {
-   var fileReader = new FileReader();
-   var that = this;
-   fileReader.onload = function(event) {
-   
that.parseIncomingArray(event.target.result);
-   };
-   fileReader.readAsArrayBuffer(msg);
-   }
-   else if (type === 'arraybuffer')
-   {
-   this.parseIncomingArray(new Uint8Array(msg));
-   }
-   else if (type === 'text' || type === '')
-   {
-   const encoder = new TextEncoder();
-   const arr = encoder.encode(msg);
-   this.parseIncomingArray(arr);
-   }
-   else
-   console.debug('Unknown encoding type: ' + type);
-   };
-   this.send = function(msg) {
-   console.debug('send msg "' + msg + '"');
+   this.sendQueue = '';
+   this.sendTimeout = undefined;
+   this.doSend = function () {
+   that.sendTimeout = undefined;
+   console.debug('send msg "' + that.sendQueue + '"');
var req = new XMLHttpRequest();
-   req.open('POST', this.getEndPoint('write'));
-   req.setRequestHeader('SessionId', this.sessionId);
-   if (this.sessionId === 'fetchsession')
-   {
-   req.responseType = 'text';
-   req.addEventListener('load', function() {
-   console.debug('got session: ' + 
this.responseText);
-   that.sessionId = this.responseText;
-   that.readyState = 1;
-   that.onopen();
-   });
-   }
+   req.open('POST', that.getEndPoint('write'));
+   req.setRequestHeader('SessionId', that.sessionId);
+   if (that.sessionId === 'fetchsession')
+   console.debug('session fetch not completed');
else
{
req.responseType = 'arraybuffer';
req.addEventListener('load', function() {
if (this.status == 200)
-   
that.parseIncoming(this.responseType, this.response);
+   that.parseIncomingArray(new 
Uint8Array(this.response));
else
console.debug('Error on 
incoming response');
});
}
-   req.send('B0x' + msg.length.toString(16) + '\n' + msg + 
'\n');
-   },
+   req.send(that.sendQueue);
+   that.sendQueue = '';
+   };
+   this.getSessionId = function() {
+   var req = new XMLHttpRequest();
+   req.open('POST', that.getEndPoint('write'));
+   req.setRequestHeader('SessionId', that.sessionId);
+   req.responseType = 'text';
+   req.addEventListener('load', function() {
+   

[Libreoffice-commits] online.git: loleaflet/js net/Socket.hpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

2020-04-24 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |   94 +--
 net/Socket.hpp |   14 +++
 wsd/DocumentBroker.hpp |2 
 wsd/LOOLWSD.cpp|2 
 wsd/ProxyProtocol.cpp  |  193 -
 wsd/ProxyProtocol.hpp  |   81 +---
 6 files changed, 328 insertions(+), 58 deletions(-)

New commits:
commit fdc062b488afaeed5eaf061e279fff73623bccf3
Author: Michael Meeks 
AuthorDate: Thu Mar 19 15:54:28 2020 +
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 13:57:49 2020 +0200

Proxy protocol bits.

For now very silly: [T|B] + hex length + \n + content + \n

Change-Id: I256b834a23cca975a705da2c569887665ac6be02
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92806
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 477c66a5d..eba6852b8 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -1,4 +1,5 @@
 /* -*- js-indent-level: 8 -*- */
+/* global Uint8Array */
 (function (global) {
 
var ua = navigator.userAgent.toLowerCase(),
@@ -212,19 +213,97 @@
};
this.onmessage = function() {
};
+   this.parseIncomingArray = function(arr) {
+   var decoder = new TextDecoder();
+   for (var i = 0; i < arr.length; ++i)
+   {
+   var left = arr.length - i;
+   if (left < 4)
+   {
+   console.debug('no data left');
+   break;
+   }
+   var type = String.fromCharCode(arr[i+0]);
+   if (type != 'T' && type != 'B')
+   {
+   console.debug('wrong data type: ' + 
type);
+   break;
+   }
+   if (arr[i+1] !== 48 && arr[i+2] !== 120) // '0x'
+   {
+   console.debug('missing hex preamble');
+   break;
+   }
+   i += 3;
+   var numStr = '';
+   var start = i;
+   while (arr[i] != 10) // '\n'
+   i++;
+   numStr = decoder.decode(arr.slice(start, i)); 
// FIXME: IE11
+   var size = parseInt(numStr, 16);
+
+   i++; // skip \n
+
+   var data;
+   if (type == 'T') // FIXME: IE11
+   data = decoder.decode(arr.slice(i, i + 
size));
+   else
+   data = arr.slice(i, i + size);
+
+   this.onmessage({ data: data });
+
+   i += size; // skip trailing '\n' in 
loop-increment
+   }
+   };
+   this.parseIncoming = function(type, msg) {
+   if (type === 'blob')
+   {
+   var fileReader = new FileReader();
+   var that = this;
+   fileReader.onload = function(event) {
+   
that.parseIncomingArray(event.target.result);
+   };
+   fileReader.readAsArrayBuffer(msg);
+   }
+   else if (type === 'arraybuffer')
+   {
+   this.parseIncomingArray(new Uint8Array(msg));
+   }
+   else if (type === 'text' || type === '')
+   {
+   const encoder = new TextEncoder();
+   const arr = encoder.encode(msg);
+   this.parseIncomingArray(arr);
+   }
+   else
+   console.debug('Unknown encoding type: ' + type);
+   };
this.send = function(msg) {
console.debug('send msg "' + msg + '"');
var req = new XMLHttpRequest();
req.open('POST', this.getEndPoint('write'));
req.setRequestHeader('SessionId', this.sessionId);
if (this.sessionId === 'fetchsession')
+   {
+   req.responseType = 'text';
req.addEventListener('load', function() {
 

[Libreoffice-commits] online.git: loleaflet/js loleaflet/src Makefile.am net/Socket.hpp wsd/ClientSession.hpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp

2020-04-24 Thread Michael Meeks (via logerrit)
 Makefile.am  |2 
 loleaflet/js/global.js   |   94 ++--
 loleaflet/src/core/Socket.js |2 
 net/Socket.hpp   |5 +
 wsd/ClientSession.hpp|3 -
 wsd/DocumentBroker.hpp   |9 +++
 wsd/LOOLWSD.cpp  |  123 ---
 wsd/ProxyProtocol.cpp|   81 
 wsd/ProxyProtocol.hpp|   97 +
 9 files changed, 399 insertions(+), 17 deletions(-)

New commits:
commit bf0662bda19fee239fc47ff0d7faa7de32788635
Author: Michael Meeks 
AuthorDate: Wed Mar 4 13:54:04 2020 +
Commit: Jan Holesovsky 
CommitDate: Fri Apr 24 13:09:09 2020 +0200

Proxy websocket prototype.

Try to read/write avoiding a websocket.

Change-Id: I382039fa88f1030a63df1e47f687df2ee5a6055b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92805
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/Makefile.am b/Makefile.am
index 521631dac..42e338913 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -111,6 +111,7 @@ loolwsd_sources = common/Crypto.cpp \
   wsd/AdminModel.cpp \
   wsd/Auth.cpp \
   wsd/DocumentBroker.cpp \
+  wsd/ProxyProtocol.cpp \
   wsd/LOOLWSD.cpp \
   wsd/ClientSession.cpp \
   wsd/FileServer.cpp \
@@ -217,6 +218,7 @@ wsd_headers = wsd/Admin.hpp \
   wsd/Auth.hpp \
   wsd/ClientSession.hpp \
   wsd/DocumentBroker.hpp \
+  wsd/ProxyProtocol.hpp \
   wsd/Exceptions.hpp \
   wsd/FileServer.hpp \
   wsd/LOOLWSD.hpp \
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index a3b1fb49c..477c66a5d 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -185,16 +185,97 @@
};
this.onopen = function() {
};
+   this.close = function() {
+   };
};
-
-   global.FakeWebSocket.prototype.close = function() {
-   };
-
global.FakeWebSocket.prototype.send = function(data) {
this.sendCounter++;
window.postMobileMessage(data);
};
 
+   global.proxySocketCounter = 0;
+   global.ProxySocket = function (uri) {
+   this.uri = uri;
+   this.binaryType = 'arraybuffer';
+   this.bufferedAmount = 0;
+   this.extensions = '';
+   this.protocol = '';
+   this.connected = true;
+   this.readyState = 0; // connecting
+   this.sessionId = 'fetchsession';
+   this.id = window.proxySocketCounter++;
+   this.sendCounter = 0;
+   this.readWaiting = false;
+   this.onclose = function() {
+   };
+   this.onerror = function() {
+   };
+   this.onmessage = function() {
+   };
+   this.send = function(msg) {
+   console.debug('send msg "' + msg + '"');
+   var req = new XMLHttpRequest();
+   req.open('POST', this.getEndPoint('write'));
+   req.setRequestHeader('SessionId', this.sessionId);
+   if (this.sessionId === 'fetchsession')
+   req.addEventListener('load', function() {
+   console.debug('got session: ' + 
this.responseText);
+   that.sessionId = this.responseText;
+   that.readyState = 1;
+   that.onopen();
+   });
+   req.send(msg);
+   },
+   this.close = function() {
+   console.debug('close socket');
+   this.readyState = 3;
+   this.onclose();
+   };
+   this.getEndPoint = function(type) {
+   var base = this.uri;
+   return base.replace(/^ws/, 'http') + '/' + type;
+   };
+   console.debug('New proxy socket ' + this.id + ' ' + this.uri);
+
+   // FIXME: perhaps a little risky.
+   this.send('fetchsession');
+   var that = this;
+
+   // horrors ...
+   this.readInterval = setInterval(function() {
+   if (this.readWaiting) // one at a time for now
+   return;
+   if (this.sessionId == 'fetchsession')
+   return; // waiting for our session id.
+   var req = new XMLHttpRequest();
+   // fetch session id:
+   req.addEventListener('load', 

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

2020-04-22 Thread Michael Meeks (via logerrit)
 loleaflet/js/global.js |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit ce54304a348b9bd81e9b0eac514ec28ce60c537a
Author: Michael Meeks 
AuthorDate: Wed Apr 22 14:48:18 2020 +0100
Commit: Michael Meeks 
CommitDate: Wed Apr 22 17:56:30 2020 +0200

Tolerate missing WOPI parameters.

Change-Id: Ic938b835aadeb299e06682b2f384db323eca0a91
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92699
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 3022d94a3..a3b1fb49c 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -280,9 +280,11 @@
else if (global.accessHeader !== '') {
wopiParams = { 'access_header': global.accessHeader };
}
-   docParams = Object.keys(wopiParams).map(function(key) {
-   return encodeURIComponent(key) + '=' + 
encodeURIComponent(wopiParams[key]);
-   }).join('&');
+   if (wopiParams) {
+   docParams = Object.keys(wopiParams).map(function(key) {
+   return encodeURIComponent(key) + '=' + 
encodeURIComponent(wopiParams[key]);
+   }).join('&');
+   }
} else {
global.docURL = filePath;
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-10 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js | 2681 +++
 1 file changed, 2681 insertions(+)

New commits:
commit 2189b88792e79c4a0de0a41e55b71e1fe91df397
Author: Tor Lillqvist 
AuthorDate: Fri Apr 10 17:30:32 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Fri Apr 10 17:00:44 2020 +0200

Restore w2field that was removed in bb6f13d94dc6063df926e918868d144f36729c14

It is used (just once, but still) in the remaining parts of
w2ui-1.5.rc1.js.

Change-Id: Ic59f9c0d7d10b3556a4f8fbe08b7af2faa77d941
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92043
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 82243a0f0..379f9d085 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -2900,6 +2900,2687 @@ w2utils.event = {
 
 })(jQuery);
 
+/
+*   Library: Web 2.0 UI for jQuery (using prototypical inheritance)
+*   - Following objects defined
+*- w2field- various field controls
+*- $().w2field- jQuery wrapper
+*   - Dependencies: jQuery, w2utils
+*
+* == NICE TO HAVE ==
+*   - upload (regular files)
+*   - BUG with prefix/postfix and arrows (test in different contexts)
+*   - multiple date selection
+*   - month selection, year selections
+*   - arrows no longer work (for int)
+*   - form to support custom types
+*   - rewrite suffix and prefix positioning with translateY()
+*   - prefix and suffix are slow (100ms or so)
+*   - MultiSelect - Allow Copy/Paste for single and multi values
+*   - add routeData to list/enum
+*   - for type: list -> read value from attr('value')
+*   - ENUM, LIST: should have same as grid (limit, offset, search, sort)
+*   - ENUM, LIST: should support wild chars
+*   - add selection of predefined times (used for appointments)
+*
+/
+
+(function ($) {
+
+var w2field = function (options) {
+// public properties
+this.el  = null;
+this.helpers = {}; // object or helper elements
+this.type= options.type || 'text';
+this.options = $.extend(true, {}, options);
+this.onSearch= options.onSearch|| null;
+this.onRequest   = options.onRequest   || null;
+this.onLoad  = options.onLoad  || null;
+this.onError = options.onError || null;
+this.onClick = options.onClick || null;
+this.onAdd   = options.onAdd   || null;
+this.onNew   = options.onNew   || null;
+this.onRemove= options.onRemove|| null;
+this.onMouseOver = options.onMouseOver || null;
+this.onMouseOut  = options.onMouseOut  || null;
+this.onIconClick = options.onIconClick || null;
+this.onScroll= options.onScroll || null;
+this.tmp = {}; // temp object
+// clean up some options
+delete this.options.type;
+delete this.options.onSearch;
+delete this.options.onRequest;
+delete this.options.onLoad;
+delete this.options.onError;
+delete this.options.onClick;
+delete this.options.onMouseOver;
+delete this.options.onMouseOut;
+delete this.options.onIconClick;
+delete this.options.onScroll;
+// extend with defaults
+$.extend(true, this, w2obj.field);
+};
+
+// 
+// -- Registers as a jQuery plugin
+
+$.fn.w2field = function (method, options) {
+// call direct
+if (this.length === 0) {
+var pr = w2field.prototype;
+if (pr[method]) {
+return pr[method].apply(pr, 
Array.prototype.slice.call(arguments, 1));
+}
+} else {
+// if without arguments - return the object
+if (arguments.length === 0) {
+var obj = $(this).data('w2field');
+return obj;
+}
+if (typeof method == 'string' && typeof options == 'object') {
+method = $.extend(true, {}, options, { type: method });
+}
+if (typeof method == 'string' && options == null) {
+method = { type: method };
+}
+method.type = String(method.type).toLowerCase();
+return this.each(function (index, el) {
+var obj = $(el).data('w2field');
+// if object is not defined, define it
+if (obj == null) {
+var obj = new w2field(method);
+$.extend(obj, { handlers: [] });
+if (el) obj.el = $(el)[0];
+obj.init();
+$(el).data('w2field', obj);
+return obj;
+   

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

2020-03-26 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/global.js   |   19 +++
 loleaflet/src/control/Control.Toolbar.js |   20 
 2 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 3a5d193fdc699ee7056f50eab34b91da15bff037
Author: Tor Lillqvist 
AuthorDate: Thu Mar 26 10:42:32 2020 +0200
Commit: Tor Lillqvist 
CommitDate: Thu Mar 26 10:13:02 2020 +0100

Move the window.mode.* functions to global.js for clarity

No idea why they were in Control.Toolbar.js.

Change-Id: I18ab812317b4bfb71d0c63a4cb2283d4fbaa3b54
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91087
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index a08c4cf3b..a4fd77bab 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -141,6 +141,25 @@
retina: (window.devicePixelRatio || (window.screen.deviceXDPI / 
window.screen.logicalXDPI)) > 1
};
 
+   global.mode = {
+   // Here "mobile" means "mobile phone" (at least for now). Has 
to match small screen size
+   // requirement.
+   isMobile: function() {
+   if (L.Browser.mobile && L.Browser.cypressTest) {
+   return true;
+   }
+
+   return L.Browser.mobile && screen.width < 768;
+   },
+   // Mobile device with big screen size.
+   isTablet: function() {
+   return L.Browser.mobile && !window.mode.isMobile();
+   },
+   isDesktop: function() {
+   return !L.Browser.mobile;
+   }
+   };
+
document.addEventListener('contextmenu', function(e) {
if (e.preventDefault) {
e.preventDefault();
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index ca854aa1f..4a115f5e2 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -15,26 +15,6 @@ function onDelete(e) {
}
 }
 
-// Make functions visible outside: window.mode.isMobile() etc.
-global.mode = {
-   // Here "mobile" means "mobile phone" (at least for now). Has to match 
small screen size
-   // requirement.
-   isMobile: function() {
-   if (L.Browser.mobile && L.Browser.cypressTest) {
-   return true;
-   }
-
-   return L.Browser.mobile && screen.width < 768;
-   },
-   // Mobile device with big screen size.
-   isTablet: function() {
-   return L.Browser.mobile && !window.mode.isMobile();
-   },
-   isDesktop: function() {
-   return !L.Browser.mobile;
-   }
-};
-
 var nUsers, oneUser, noUser;
 
 function _updateVisibilityForToolbar(toolbar) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-19 Thread Henry Castro (via logerrit)
 loleaflet/js/global.js   |1 +
 loleaflet/src/core/Socket.js |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit a09a0877d17ccee383403c4c4d6bd4427e6fcdde
Author: Henry Castro 
AuthorDate: Thu Mar 12 23:29:39 2020 -0400
Commit: Andras Timar 
CommitDate: Thu Mar 19 08:56:09 2020 +0100

loleaflet: ensure forward message if early websocket is connected

This should never happen, since the _onMessage is re-assigned when
loadDocument is called, but it is better to ensure to forward all
messages.

Change-Id: I9a792bc077b26f2f92c30c4e7851c9d2b2637bfb
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90449
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index f98450fb0..a08c4cf3b 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -320,6 +320,7 @@
 
global.socket.onmessage = function (event) {
if (typeof global.socket._onMessage === 'function') {
+   global.socket._emptyQueue();
global.socket._onMessage(event);
} else {
global.queueMsg.push(event.data);
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index a173ef784..b4118479f 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -76,8 +76,11 @@ L.Socket = L.Class.extend({
}
 
// process messages for early socket connection
-   if (socket && ((socket.readyState === 1 || socket.readyState 
=== 0)) &&
-   window.queueMsg && window.queueMsg.length > 0) {
+   this._emptyQueue();
+   },
+
+   _emptyQueue: function () {
+   if (window.queueMsg && window.queueMsg.length > 0) {
for (var it = 0; it < window.queueMsg.length; it++) {
this._onMessage({data: window.queueMsg[it]});
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-17 Thread Henry Castro (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |16475 +--
 1 file changed, 598 insertions(+), 15877 deletions(-)

New commits:
commit bb6f13d94dc6063df926e918868d144f36729c14
Author: Henry Castro 
AuthorDate: Fri Feb 14 12:28:36 2020 -0400
Commit: Michael Meeks 
CommitDate: Mon Feb 17 14:57:19 2020 +0100

w2ui: remove unused components

w2ui is bundled with: w2grid, w2layout, w2popup,
w2tabs, w2sidebar, w2fields, w2form

But they are not used in desktop nor mobile and
it is preferable to remove the dead code to reduce
bundle size, parse with mobile devices.

If in a near future, these components are used,
still we can restore the components.

Change-Id: I522f01a73217635acc9828a54006111fa196636d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88735
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 687a00202..82243a0f0 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -2903,302 +2903,65 @@ w2utils.event = {
 /
 *   Library: Web 2.0 UI for jQuery (using prototypical inheritance)
 *   - Following objects defined
-*- w2grid- grid widget
-*- $().w2grid- jQuery wrapper
-*   - Dependencies: jQuery, w2utils, w2toolbar, w2fields
+*- w2toolbar- toolbar widget
+*- $().w2toolbar- jQuery wrapper
+*   - Dependencies: jQuery, w2utils, w2field
 *
 * == NICE TO HAVE ==
-*   - column autosize based on largest content
-*   - reorder columns/records
-*   - problem with .set() and arrays, array get extended too, but should be 
replaced
-*   - after edit stay on the same record option
-*   - if supplied array of ids, get should return array of records
-*   - allow functions in routeData (also add routeData to list/enum)
-*   - implement global routeData and all elements read from there
-*   - send parsed URL to the event if there is routeData
-*   - if you set searchData or sortData and call refresh() it should work
-*   - add selectType: 'none' so that no selection can be make but with mouse
-*   - reorder records with frozen columns
-*   - focus/blur for selectType = cell not display grayed out selection
-*   - frozen columns
-- load more only on the right side
-- scrolling on frozen columns is not working only on regular columns
-*   - copy or large number of records is slow
-*   - reusable search component (see 
https://github.com/vitmalina/w2ui/issues/914#issuecomment-107340524)
-*   - allow enum in inline edit (see 
https://github.com/vitmalina/w2ui/issues/911#issuecomment-107341193)
-*   - if record has no recid, then it should be index in the aray (should not 
be 0)
-*
-* == KNOWN ISSUES ==
-*   - bug: vs_start = 100 and more then 500 records, when scrolling empty sets
-*   - row drag and drop has bugs
-*   - Shift-click/Ctrl-click/Ctrl-Shift-Click selection is not as robust as it 
should be
-*
-* == 1.5 changes
-*   - $('#grid').w2grid() - if called w/o argument then it returns grid object
-*   - added statusRange : true,
-*   statusBuffered  : false,
-*   statusRecordID  : true,
-*   statusSelection : true,
-*   statusResponse  : true,
-*   statusSort  : true,
-*   statusSearch: true,
-*   - change selectAll() and selectNone() - return time it took
-*   - added vs_start and vs_extra
-*   - added update(cells) - updates only data in the grid (or cells)
-*   - add to docs onColumnDragStart, onColumnDragEnd
-*   - onSelect and onSelect should fire 1 time for selects with shift or 
selectAll(), selectNone()
-*   - record.w2ui.style[field_name]
-*   - use column field for style: { 1: 'color: red' }
-*   - added focus(), blur(), onFocus, onBlur
-*   - search.simple - if false, will not show up in simple search
-*   - search.operator - default operator to use with search field
-*   - search.operators - array of operators for the serach
-*   - search.hidden - could not be clearned by the user
-*   - search.value - only for hidden searches
-*   - if .search(val) - search all fields
-*   - refactor reorderRow (not finished)
-*   - return JSON can now have summary array
-*   - frozen columns
-*   - added selectionSave, selectionRestore - for internal use
-*   - added additional search filter options for int, float, date, time
-*   - added getLineHTML
-*   - added lineNumberWidth
-*   - add searches.style
-*   - getColumn without params returns fields of all columns
-*   - getSearch without params returns fields of all searches
-*   - added column.tooltip
-*   - added hasFocus, refactored w2utils.keyboard
-*   - do not clear selection when clicked and it was not in focus
-*   - added record.w2ui.colspan
-*   - editable area extends with typing
-*   - removed onSubmit and onDeleted - now it uses onSave and onDelete
-*  

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

2020-01-08 Thread Henry Castro (via logerrit)
 loleaflet/js/global.js|8 
 loleaflet/src/main.js |4 
 loleaflet/src/map/handler/Map.TouchGesture.js |2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit e9d11f4a6605809d52d4205ec9ff91a6ffef143b
Author: Henry Castro 
AuthorDate: Tue Jan 7 14:04:14 2020 -0400
Commit: Henry Castro 
CommitDate: Wed Jan 8 18:21:14 2020 +0100

loleaflet: simplify "prevent default 'contextmenu' action"

The mobile and desktop prevents default 'contextmenu' action

Change-Id: I89171c955c153b2fceaad92970e2eaf039cb8527
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86373
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index b3b619f8c..8445ecb4f 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -1,6 +1,14 @@
 /* -*- js-indent-level: 8 -*- */
 (function (global) {
 
+   document.addEventListener('contextmenu', function(e) {
+   if (e.preventDefault) {
+   e.preventDefault();
+   } else {
+   e.returnValue = false;
+   }
+   }, false);
+
global.fakeWebSocketCounter = 0;
global.FakeWebSocket = function () {
this.binaryType = 'arraybuffer';
diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index fb7890b36..ba500fd09 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -91,10 +91,6 @@ window.addEventListener('beforeunload', function () {
}
 });
 
-if (!L.Browser.mobile) {
-   L.DomEvent.on(document, 'contextmenu', L.DomEvent.preventDefault);
-}
-
 window.bundlejsLoaded = true;
 
 }(window));
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js 
b/loleaflet/src/map/handler/Map.TouchGesture.js
index 66c333791..f6f22761e 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -62,7 +62,7 @@ L.Map.TouchGesture = L.Handler.extend({
}
 
L.DomEvent.on(this._map._mapPane, 'mousedown mousemove 
mouseup', L.DomEvent.preventDefault);
-   L.DomEvent.on(document, 'contextmenu touchmove', 
L.DomEvent.preventDefault);
+   L.DomEvent.on(document, 'touchmove', 
L.DomEvent.preventDefault);
}
 
for (var events in L.Draggable.MOVE) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-08 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 152a20df3a58fc79e79d6baa6a50e755ad3faae2
Author: Tor Lillqvist 
AuthorDate: Wed Jan 8 16:26:32 2020 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Jan 8 16:29:45 2020 +0200

Revert "tdf#129374: Make the overlay wider on iOS if it seems necessary"

There is a better fix coming.

This reverts commit ce7ad16087701adf9803f2dfd3b2da0eb2718668.

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index a9e48c1b2..687a00202 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -2388,13 +2388,6 @@ w2utils.event = {
 Y = (offset.top + w2utils.getSize(obj, 'height') + 
options.top + 7);
 offsetTop = offset.top;
 }
-
-// tdf#129374 make the overlay wider so that it is more likely 
all we want to put in it will fit. Yes, this
-// is just horrible heuristics. The sane thing would be if 
this w2ui code could itself make sure that the
-// overlay thing grows in width if necessary as stuff is added 
to it so that they all show up.
-if (window.ThisIsTheiOSApp && X > window.innerWidth - 300)
-   X = window.innerWidth - 300;
-
 div1.css({
 left:  X + 'px',
 top :  Y + 'px',
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-07 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit ce7ad16087701adf9803f2dfd3b2da0eb2718668
Author: Tor Lillqvist 
AuthorDate: Tue Jan 7 11:47:47 2020 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Jan 7 11:28:52 2020 +0100

tdf#129374: Make the overlay wider on iOS if it seems necessary

Horrible hack, but works for the specific case described in the bug at
least.

Change-Id: I55150d84dc892ece69540fdc0d06bc277891c1fa
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86328
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index fb5572b75..8d6562a6e 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -2388,6 +2388,13 @@ w2utils.event = {
 Y = (offset.top + w2utils.getSize(obj, 'height') + 
options.top + 7);
 offsetTop = offset.top;
 }
+
+// tdf#129374 make the overlay wider so that it is more likely 
all we want to put in it will fit. Yes, this
+// is just horrible heuristics. The sane thing would be if 
this w2ui code could itself make sure that the
+// overlay thing grows in width if necessary as stuff is added 
to it so that they all show up.
+if (window.ThisIsTheiOSApp && X > window.innerWidth - 300)
+   X = window.innerWidth - 300;
+
 div1.css({
 left:  X + 'px',
 top :  Y + 'px',
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-20 Thread Marco Cecchetti (via logerrit)
 loleaflet/js/global.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fa4bd903390aa010950f658637bf2d00a98947df
Author: Marco Cecchetti 
AuthorDate: Thu Dec 19 14:49:59 2019 +0100
Commit: Marco Cecchetti 
CommitDate: Fri Dec 20 20:33:09 2019 +0100

loleaflet: check if LOCALIZATIONS is defined on mobile app

Change-Id: I066670f3bde7f028ae01624a3b475bc0939f2c31
Reviewed-on: https://gerrit.libreoffice.org/85634
Reviewed-by: Marco Cecchetti 
Tested-by: Marco Cecchetti 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index b582afd16..b3b619f8c 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -85,7 +85,7 @@
// In the mobile app case we can't use the stuff from 
l10n-for-node, as that assumes HTTP.
if (window.ThisIsAMobileApp) {
// We use another approach just for iOS for now.
-   if (window.LOCALIZATIONS.hasOwnProperty(string)) {
+   if (window.LOCALIZATIONS && 
window.LOCALIZATIONS.hasOwnProperty(string)) {
// window.postMobileDebug('_(' + string + '): 
YES: ' + window.LOCALIZATIONS[string]);
var result = window.LOCALIZATIONS[string];
if (window.LANG === 'de-CH') {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-04 Thread Pedro Pinto Silva (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |8 +---
 loleaflet/src/control/Control.Toolbar.js |   11 +++
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 3aa715260d2f4c623f386a4ad9502cfe4af57ae6
Author: Pedro Pinto Silva 
AuthorDate: Wed Dec 4 14:56:36 2019 +0100
Commit: Pedro Pinto da Silva 
CommitDate: Wed Dec 4 14:58:41 2019 +0100

Toolbar: background color and text color: Color appears now as a bottom 
stripe

Change-Id: If338b10ce3e117a8f43b9bb920820c3d1de324af
Reviewed-on: https://gerrit.libreoffice.org/84415
Reviewed-by: Pedro Pinto da Silva 
Tested-by: Pedro Pinto da Silva 

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 9d6820e3d..fb5572b75 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -13842,16 +13842,18 @@ var w2prompt = function (label, title, callBack) {
 case 'color':
 case 'text-color':
 if (typeof item.color == 'string' && 
item.color.substr(0,1) == '#') item.color = item.color.substr(1);
+/*
 if (item.type == 'color') {
 text = ''+
(item.text ? '' 
+ w2utils.lang(item.text) + '' : '');
 }
-if (item.type == 'text-color') {
+*/
+/*if (item.type == 'text-color') {
 text = ''+
 (item.text ? w2utils.lang(item.text) : 
'Aa') +
'';
-}
+}*/
 case 'menu':
 case 'menu-check':
 case 'menu-radio':
@@ -13879,7 +13881,7 @@ var w2prompt = function (label, title, callBack) {
 ? ''+ item.count +''
 : ''
 ) +
-(((['menu', 'menu-radio', 'menu-check', 
'drop', 'color', 'text-color'].indexOf(item.type) != -1) && item.arrow !== 
false) ?
+(((['menu', 'menu-radio', 'menu-check', 
'drop'].indexOf(item.type) != -1) && item.arrow !== false) ?
 '' : '') +
 '  '+
 '';
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 2f735f033..fc5fa8197 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -1772,6 +1772,9 @@ function onCommandStateChanged(e) {
 
color = color.toString(16);
color = '#' + Array(7 - color.length).join('0') + color;
+   $('#tb_editbar_item_fontcolor 
.w2ui-tb-image').css('box-shadow', 'inset 0 -2px #ff, inset 0px -6px ' + 
color);
+   $('#tb_editbar_item_fontcolor 
.w2ui-tb-down').css('display', 'none');
+   $('#tb_editbar_item_fontcolor 
.w2ui-tb-caption').css('display', 'none');
}
div = L.DomUtil.get('fontcolorindicator');
if (div) {
@@ -1787,6 +1790,14 @@ function onCommandStateChanged(e) {
else {
color = color.toString(16);
color = '#' + Array(7 - color.length).join('0') + color;
+   //writer
+   $('#tb_editbar_item_backcolor 
.w2ui-tb-image').css('box-shadow', 'inset 0 -2px #ff, inset 0px -6px ' + 
color);
+   $('#tb_editbar_item_backcolor 
.w2ui-tb-down').css('display', 'none');
+   $('#tb_editbar_item_backcolor 
.w2ui-tb-caption').css('display', 'none');
+   //calc?
+   $('#tb_editbar_item_backgroundcolor 
.w2ui-tb-image').css('box-shadow', 'inset 0 -2px #ff, inset 0px -6px ' + 
color);
+   $('#tb_editbar_item_backgroundcolor 
.w2ui-tb-down').css('display', 'none');
+   $('#tb_editbar_item_backgroundcolor 
.w2ui-tb-caption').css('display', 'none');
}
div = L.DomUtil.get('backcolorindicator');
if (div) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-16 Thread Henry Castro (via logerrit)
 loleaflet/js/jquery.mCustomScrollbar.js |   25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

New commits:
commit 2644c113c2b6c839793c9221d735de5e21cc76ed
Author: Henry Castro 
AuthorDate: Fri Nov 15 10:13:10 2019 -0400
Commit: Henry Castro 
CommitDate: Sat Nov 16 19:28:31 2019 +0100

mCustomScrollbar: add event listener to pointer or touch events

Some mobile devices support both pointer and touch events,
so if we add event listener it will fire 2 times.

Change-Id: Ida9862e9ee24e47ccbe3963b5c4ff18a173fffe0
Reviewed-on: https://gerrit.libreoffice.org/82799
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index b2c91c88e..42876a14e 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1267,7 +1267,24 @@ and dependencies (minified).
},
/*  */

-   
+   _getTouchEvents=function(namespace){
+   var eventStart, eventMove, eventEnd;
+   if ('ontouchstart' in window){
+   eventStart = "touchstart."+namespace;
+   eventMove = "touchmove."+namespace;
+   eventEnd = "touchend."+namespace;
+   } else if (window.MSPointerEvent){
+   eventStart = "MSPointerDown."+namespace;
+   eventMove = "MSPointerMove."+namespace;
+   eventEnd = "MSPointerUp."+namespace;
+   } else if (window.PointerEvent){
+   eventStart = "pointerdown."+namespace;
+   eventMove = "pointermove."+namespace;
+   eventEnd = "pointerup."+namespace;
+   }
+   return [eventStart, eventMove, eventEnd];
+   },
+
/* 
TOUCH SWIPE EVENTS
scrolls content via touch swipe 
@@ -1282,11 +1299,7 @@ and dependencies (minified).

draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
durA=0,durB,overwrite=o.axis==="yx" ? "none" : 
"all",touchIntent=[],touchDrag,docDrag,
iframe=mCSB_container.find("iframe"),
-   events=[
-   "touchstart."+namespace+" 
pointerdown."+namespace+" MSPointerDown."+namespace, //start
-   "touchmove."+namespace+" 
pointermove."+namespace+" MSPointerMove."+namespace, //move
-   "touchend."+namespace+" 
pointerup."+namespace+" MSPointerUp."+namespace //end
-   ],
+   events=_getTouchEvents(namespace),

touchAction=document.body.style.touchAction!==undefined;
mCSB_container.bind(events[0],function(e){
_onTouchstart(e);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-15 Thread Henry Castro (via logerrit)
 loleaflet/js/global.js |   24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 3e2ec0854dd730831db1d7a2bd33e397459fc7f1
Author: Henry Castro 
AuthorDate: Tue Nov 12 14:49:19 2019 -0400
Commit: Henry Castro 
CommitDate: Fri Nov 15 15:49:52 2019 +0100

loleaflet: add missing parameters when early websocket connection

Add some missing parameters when the "websocket" is connected after
loleaflet.html while "bundle.js" is downloading and ready to execute.

Change-Id: I36995a3c82ce17fa5a81923e8d6d785f0c1c7742
Reviewed-on: https://gerrit.libreoffice.org/82546
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index ffc0a1d4b..e44d613a6 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -135,18 +135,32 @@
}
}
 
+   var lang = global.getParameterByName('lang');
global.queueMsg = [];
if (window.ThisIsTheiOSApp)
-   window.LANG = window.getParameterByName('lang');
+   window.LANG = lang;
if (global.socket && global.socket.readyState !== 3) {
global.socket.onopen = function () {
if (global.socket.readyState === 1) {
var ProtocolVersionNumber = '0.1';
+   var timestamp = 
global.getParameterByName('timestamp');
+   var msg = 'load url=' + 
encodeURIComponent(global.docURL);
+
global.socket.send('loolclient ' + 
ProtocolVersionNumber);
-   if (window.ThisIsTheiOSApp)
-   global.socket.send('load url=' + 
encodeURIComponent(global.docURL) + ' lang=' + window.LANG);
-   else
-   global.socket.send('load url=' + 
encodeURIComponent(global.docURL));
+
+   if (window.ThisIsTheiOSApp) {
+   msg += ' lang=' + window.LANG;
+   } else {
+
+   if (timestamp) {
+   msg += ' timestamp=' + 
timestamp;
+   }
+   if (lang) {
+   msg += ' lang=' + lang;
+   }
+   // renderingOptions?
+   }
+   global.socket.send(msg);
}
}
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-05 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/w2ui-1.5.rc1.js |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 8c5b61b41e00afece42dcf3a07c3fa7eb5e4b986
Author: Tor Lillqvist 
AuthorDate: Fri Oct 18 19:02:16 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Tue Nov 5 17:00:51 2019 +0200

tdf#126973: Don't do anything in the tooltip show and hide functions on iOS

I have no understanding of what this code does and how it works but
this seems to fix the problem described in the bug.

Change-Id: I7188745b5c77d9e065828336b7dd6524aedc1dce
Reviewed-on: https://gerrit.libreoffice.org/81079
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 
(cherry picked from commit b95a22a740bccbd50d6cf49ad0b5fdbd1d489a90)

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index fbbcc3d63..9d6820e3d 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -9203,6 +9203,7 @@ w2utils.event = {
 },
 
 columnTooltipShow: function (ind) {
+if (window.ThisIsTheiOSApp) return;
 if (this.columnTooltip == 'normal') return;
 var $el  = $(this.box).find('#grid_'+ this.name + '_column_'+ ind);
 var item = this.columns[ind];
@@ -9218,6 +9219,7 @@ w2utils.event = {
 },
 
 columnTooltipHide: function (ind) {
+if (window.ThisIsTheiOSApp) return;
 if (this.columnTooltip == 'normal') return;
 var $el  = $(this.box).find('#grid_'+ this.name + '_column_'+ ind);
 var item = this.columns[ind];
@@ -12912,6 +12914,7 @@ var w2prompt = function (label, title, callBack) {
 },
 
 tooltipShow: function (id, event, forceRefresh) {
+if (window.ThisIsTheiOSApp) return;
 if (this.tooltip == null) return;
 var $el  = $(this.box).find('#tabs_'+ this.name + '_tab_'+ 
w2utils.escapeId(id));
 var item = this.get(id);
@@ -12932,6 +12935,7 @@ var w2prompt = function (label, title, callBack) {
 },
 
 tooltipHide: function (id) {
+if (window.ThisIsTheiOSApp) return;
 if (this.tooltip == null) return;
 var $el  = $(this.box).find('#tabs_'+ this.name + '_tab_'+ 
w2utils.escapeId(id));
 var item = this.get(id);
@@ -13897,6 +13901,7 @@ var w2prompt = function (label, title, callBack) {
 },
 
 tooltipShow: function (id, event, forceRefresh) {
+if (window.ThisIsTheiOSApp) return;
 if (this.tooltip == null) return;
 var $el  = $(this.box).find('#tb_'+ this.name + '_item_'+ 
w2utils.escapeId(id));
 var item = this.get(id);
@@ -13918,6 +13923,7 @@ var w2prompt = function (label, title, callBack) {
 },
 
 tooltipHide: function (id, event) {
+if (window.ThisIsTheiOSApp) return;
 if (this.tooltip == null) return;
 var $el  = $(this.box).find('#tb_'+ this.name + '_item_'+ 
w2utils.escapeId(id));
 var item = this.get(id);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-31 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/global.js |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6ca47a7ab0f7affe02d1e3fe588e1182c91d28ca
Author: Tor Lillqvist 
AuthorDate: Thu Oct 31 10:03:47 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Thu Oct 31 10:24:01 2019 +0200

For a mobile app, call window.postMobileError() in window.onerror()

Sadly it doesn't seem to work, though, at least on iOS, if I as a test
re-introduce the error that was fixed by
2ddd8d7c8150950c48831279579f3caab578378b. But maybe it will work for
other uncaught errors. Clearly it is better than letting the code
attempt do the XMLHttpRequest thing which is totally wrong and
pointless in an app.

Change-Id: I7b6e95556603b680527a0516f54e24dc10e96b21

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 9e603b3d6..ffc0a1d4b 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -47,7 +47,9 @@
column: col
}, desc = err.message || {}, stack = err.stack || {};
var log = 'jserror ' + JSON.stringify(data, null, 2) + 
'\n' + desc + '\n' + stack + '\n';
-   if (global.socket && (global.socket instanceof 
WebSocket) && global.socket.readyState === 1) {
+   if (window.ThisIsAMobileApp) {
+   window.postMobileError(log);
+   } else if (global.socket && (global.socket instanceof 
WebSocket) && global.socket.readyState === 1) {
global.socket.send(log);
} else if (global.socket && (global.socket instanceof 
global.L.Socket) && global.socket.connected()) {
global.socket.sendMessage(log);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: loleaflet/js loleaflet/util

2019-09-16 Thread Tor Lillqvist (via logerrit)
 loleaflet/js/global.js   |7 ++-
 loleaflet/util/create-l10n-all-js.pl |2 --
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 6892259703be1298b9e6ee63ef786c0355fcf136
Author: Tor Lillqvist 
AuthorDate: Fri Aug 16 18:09:58 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Mon Sep 16 17:36:53 2019 +0200

tdf#126971: Fix localisation of tunnelled dialogs in the iOS app

This used to work fine, but at some stage it had regressed. I did not
bother bisecting to find the culprit. Anyway, now the JS part needs to
send a lang parameter in the load message, too, for the corrent
language to be used in the tunnelled dialogs. (Likely it affects also
other things in core.)

Change-Id: I339cddb28357978414669964106cb6fa472c967f
Reviewed-on: https://gerrit.libreoffice.org/77599
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 
Reviewed-on: https://gerrit.libreoffice.org/79023

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index a8e5eb8f5..9e603b3d6 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -134,12 +134,17 @@
}
 
global.queueMsg = [];
+   if (window.ThisIsTheiOSApp)
+   window.LANG = window.getParameterByName('lang');
if (global.socket && global.socket.readyState !== 3) {
global.socket.onopen = function () {
if (global.socket.readyState === 1) {
var ProtocolVersionNumber = '0.1';
global.socket.send('loolclient ' + 
ProtocolVersionNumber);
-   global.socket.send('load url=' + 
encodeURIComponent(global.docURL));
+   if (window.ThisIsTheiOSApp)
+   global.socket.send('load url=' + 
encodeURIComponent(global.docURL) + ' lang=' + window.LANG);
+   else
+   global.socket.send('load url=' + 
encodeURIComponent(global.docURL));
}
}
 
diff --git a/loleaflet/util/create-l10n-all-js.pl 
b/loleaflet/util/create-l10n-all-js.pl
index 013f340b3..0cdba7db2 100644
--- a/loleaflet/util/create-l10n-all-js.pl
+++ b/loleaflet/util/create-l10n-all-js.pl
@@ -29,8 +29,6 @@ sub insert($) {
 # woefully incomplete translation is worse than no translation at all.
 
 print "\
-window.LANG = window.getParameterByName('lang');
-window.postMobileDebug('LANG is ' + window.LANG);
 
 var onlylang = window.LANG;
 var hyphen = onlylang.indexOf('-');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-17 Thread Libreoffice Gerrit user
 loleaflet/js/jquery.mCustomScrollbar.js |   27 +++
 loleaflet/src/control/Control.Scroll.js |5 -
 2 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit cff5791f2e410387212feac1305da7763f8ac90d
Author: Szymon Kłos 
AuthorDate: Thu Apr 11 13:32:24 2019 +0200
Commit: Szymon Kłos 
CommitDate: Wed Apr 17 16:28:55 2019 +0200

Prevent view from jumping on zoom in/out on mobile

Change-Id: I29262d518d61a4a06d66271033c958e56ff16a2b
Reviewed-on: https://gerrit.libreoffice.org/70592
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 
(cherry picked from commit 42a739a7bc53f9992056de4e00db90a5e613c04c)
Reviewed-on: https://gerrit.libreoffice.org/70887
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index 9437406d2..14bf9d9a2 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -284,6 +284,11 @@ and dependencies (minified).
*/
updateOnContentResize:true,
/*
+   prevent from updating view position after 
content resize to avoid jumping on mobile devices
+   values: boolean
+   */
+   jumpOnContentResize:true,
+   /*
auto-update scrollbars each time each image 
inside the element is fully loaded 
values: "auto", boolean
*/
@@ -561,31 +566,37 @@ and dependencies (minified).
var 
to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
if(o.axis!=="x"){ /* y/yx axis 
*/
if(!d.overflowed[0]){ 
/* y scrolling is not required */
-   
_resetContentPosition.call(this); /* reset content position */
+   
if(o.advanced.jumpOnContentResize)
+   
_resetContentPosition.call(this); /* reset content position */

if(o.axis==="y"){

_unbindEvents.call(this);
-   }else 
if(o.axis==="yx" && d.overflowed[1]){
+   }else 
if(o.axis==="yx" && d.overflowed[1] && o.advanced.jumpOnContentResize){

_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
}
-   }else 
if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
+   }else 
if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()
+   && 
o.advanced.jumpOnContentResize){

_resetContentPosition.call(this); /* reset content position */
}else{ /* y scrolling 
is required */
-   
_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
+   
if(o.advanced.jumpOnContentResize)
+   
_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});

d.contentReset.y=null;
}
}
if(o.axis!=="y"){ /* x/yx axis 
*/
if(!d.overflowed[1]){ 
/* x scrolling is not required */
-   
_resetContentPosition.call(this); /* reset content position */
+   
if(o.advanced.jumpOnContentResize)
+   
_resetContentPosition.call(this); /* reset content position */

if(o.axis==="x"){

_unbindEvents.call(this);
- 

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

2019-04-05 Thread Libreoffice Gerrit user
 loleaflet/js/jquery.mCustomScrollbar.js |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 6cc7bad2e035416044020cc9adc876a2d15d63db
Author: Szymon Kłos 
AuthorDate: Thu Apr 4 18:36:21 2019 +0200
Commit: Szymon Kłos 
CommitDate: Fri Apr 5 10:59:21 2019 +0200

Calc scrolling with selection fix

Scrolling with selected sheet was endless.
This change allows scrolling using mouse wheel
when scrollbar is close to the end of screen
and prevents from doubled updates.

Extension of work done before in:
ec24337b11e097e98266c51d8fe56c42a8ec613a

Change-Id: Id76818158c0d9988b323ec52a408efd5ae6a9da5
Reviewed-on: https://gerrit.libreoffice.org/70266
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index e242263e2..9437406d2 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -632,6 +632,15 @@ and dependencies (minified).

if($this.data(pluginPfx)){ /* check if 
plugin has initialized */

+   /* Ugly hack extension: When 
vertical scrollbar position
+  was very close to the end of 
spreadsheet, next part of
+  the document has to be 
loaded. This contidion is fulfilled
+  in that case. We need to 
ignore it to prevent scrollbar
+  from reaching the end what 
blocks possibility to scroll down. */
+   if(!window.ThisIsAMobileApp && 
options && options.timeout == undefined
+   && 
options.calledFromInvalidateCursorMsg == undefined)
+   return;
+
var 
d=$this.data(pluginPfx),o=d.opt,
/* method default 
options */
methodDefaults={
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-30 Thread Libreoffice Gerrit user
 loleaflet/js/global.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 68be4badb21e7fd2ae7ce36632383e008086c507
Author: Henry Castro 
AuthorDate: Sat Mar 30 16:40:35 2019 -0400
Commit: Henry Castro 
CommitDate: Sat Mar 30 16:58:08 2019 -0400

loleaflet: fix the prototype property of a constructor L.Socket

Change-Id: Ie0086b6e1129fa9aaba416e44d49829fe605ded6

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 664a06e37..344ada470 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -127,7 +127,7 @@
}
 
global.socket.onmessage = function (event) {
-   if (global.L && global.socket instanceof L.Socket) {
+   if (global.L && global.socket instanceof 
global.L.Socket) {
global.socket._onMessage(event);
} else {
global.queueMsg.push(event.data);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am

2019-03-20 Thread Libreoffice Gerrit user
 loleaflet/Makefile.am  |4 +++-
 loleaflet/js/global.js |8 
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 345df913de36ca563fb2b91ff2838bb691665f03
Author: Jan Holesovsky 
AuthorDate: Wed Mar 20 09:44:39 2019 +0100
Commit: Jan Holesovsky 
CommitDate: Wed Mar 20 09:44:39 2019 +0100

Revert "loleaflet: remove jquery-ui.js"

This is needed for the functionality of the dialogs.

This reverts commit e81441f63bb19981fa5a47b0fd251a91a8b98c1f.

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 5d3f735d6..5f51a91a4 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -78,7 +78,8 @@ LOLEAFLET_CSS =\
$(builddir)/node_modules/vex-js/css/vex-theme-bottom-right-corner.css \
$(builddir)/node_modules/smartmenus/dist/css/sm-core-css.css \
$(builddir)/node_modules/smartmenus/dist/css/sm-simple/sm-simple.css \
-   $(srcdir)/css/menubar.css
+   $(srcdir)/css/menubar.css \
+   $(builddir)/node_modules/jquery-ui/themes/ui-lightness/jquery-ui.css
 
 LOLEAFLET_CSS_DST = $(foreach file,$(LOLEAFLET_CSS),$(builddir)/dist/$(notdir 
$(file)))
 LOLEAFLET_CSS_M4 = $(strip $(foreach file,$(LOLEAFLET_CSS),$(notdir $(file
@@ -90,6 +91,7 @@ NODE_MODULES_JS =\
node_modules/jquery/dist/jquery.js \
node_modules/jquery-mousewheel/jquery.mousewheel.js \
node_modules/jquery-contextmenu/dist/jquery.contextMenu.js \
+   node_modules/jquery-ui/jquery-ui.js \
node_modules/smartmenus/dist/jquery.smartmenus.js \
node_modules/autolinker/dist/Autolinker.js \
node_modules/json-js/json2.js \
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 60a833ef5..664a06e37 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -38,6 +38,14 @@
}
}
 
+   // fix jquery-ui
+   // var jQuery = require('jquery');
+   global.require = function (path) {
+   if (path=='jquery') {
+   return global.jQuery;
+   }
+   };
+
global.getParameterByName = function (name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + 

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

2019-03-12 Thread Libreoffice Gerrit user
 loleaflet/js/global.js   |2 +-
 loleaflet/src/core/Socket.js |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 746a81c0f0df2969f6e9f43c199bb456e9328cf1
Author: Henry Castro 
AuthorDate: Tue Mar 12 14:56:11 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 12 14:58:19 2019 -0400

loleaflet: fix "failed: WebSocket is closed before...

the connection is established"

Change-Id: Icb44f1a9fe75ac995f9a771d0a0f052c55339df3

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index c6994ef84..b2e574bd1 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -90,8 +90,8 @@
var filePath = global.getParameterByName('file_path');
var wopiSrc = global.getParameterByName('WOPISrc');
if (wopiSrc != '') {
-   wopiSrc = '?WOPISrc=' + wopiSrc + '=/ws';
global.docURL = decodeURIComponent(wopiSrc);
+   wopiSrc = '?WOPISrc=' + wopiSrc + '=/ws';
if (global.accessToken !== '') {
wopiParams = { 'access_token': global.accessToken, 
'access_token_ttl': global.accessTokenTTL };
}
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index b48d33935..84fa0f304 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -82,7 +82,8 @@ L.Socket = L.Class.extend({
}
 
// process messages for early socket connection
-   if (window.queueMsg && window.queueMsg.length > 0) {
+   if (socket && ((socket.readyState === 1 || socket.readyState 
=== 0)) &&
+   window.queueMsg && window.queueMsg.length > 0) {
for (var it = 0; it < window.queueMsg.length; it++) {
this._onMessage({data: window.queueMsg[it]});
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-07 Thread Libreoffice Gerrit user
 loleaflet/js/global.js   |9 ++---
 loleaflet/js/main.js |   10 ++
 loleaflet/src/core/Socket.js |   22 ++
 loleaflet/src/map/Map.js |4 ++--
 4 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit 2774a048332b5a430abc00aa904eec57f8f40efb
Author: Henry Castro 
AuthorDate: Thu Mar 7 14:02:15 2019 -0400
Commit: Henry Castro 
CommitDate: Thu Mar 7 14:13:52 2019 -0400

loleaflet: improve early "websocket" connection

Normally the "websocket" is created and start a connection when browser
evaluate "bundle.js" after download it.
So we create an early "websocket" connection after the browser parse
"loleaflet.html" and start receiving tiles to improve load page
performance

Change-Id: I56fca7a2da39031222c1d43781825997221385a1

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index f46f68a26..c6994ef84 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -118,9 +118,8 @@
}
}
 
+   global.queueMsg = [];
if (global.socket && global.socket.readyState !== 3) {
-   global.queueMsg = [];
-
global.socket.onopen = function () {
if (global.socket.readyState === 1) {
var ProtocolVersionNumber = '0.1';
@@ -138,7 +137,11 @@
}
 
global.socket.onmessage = function (event) {
-   global.queueMsg.push(event.data);
+   if (global.L && global.socket instanceof L.Socket) {
+   global.socket._onMessage(event);
+   } else {
+   global.queueMsg.push(event.data);
+   }
}
 
global.socket.binaryType = 'arraybuffer';
diff --git a/loleaflet/js/main.js b/loleaflet/js/main.js
index da0355451..ac25ff3f1 100644
--- a/loleaflet/js/main.js
+++ b/loleaflet/js/main.js
@@ -75,15 +75,9 @@ map.addControl(L.control.alertDialog());
 map.addControl(L.control.lokDialog());
 map.addControl(L.control.contextMenu());
 map.addControl(L.control.infobar());
-if (global.socket && (global.socket.readyState === 1 || 
global.socket.readyState === 0)) {
-   map._socket.attach(global.socket, global.queueMsg);
-} else {
-   map.loadDocument();
-}
-
-delete global.socket;
-delete global.queueMsg;
+map.loadDocument(global.socket);
 
+global.socket = map._socket;
 window.addEventListener('beforeunload', function () {
if (map && map._socket) {
map._socket.close();
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 5b0b4..b48d33935 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -23,7 +23,7 @@ L.Socket = L.Class.extend({
this._msgQueue = [];
},
 
-   connect: function() {
+   connect: function(socket) {
var map = this._map;
if (map.options.permission) {
map.options.docParams['permission'] = 
map.options.permission;
@@ -34,7 +34,9 @@ L.Socket = L.Class.extend({
if (window.ThisIsAMobileApp) {
this.socket = new window.FakeWebSocket();
window.TheFakeWebSocket = this.socket;
-   } else {
+   } else if (socket && (socket.readyState === 1 || 
socket.readyState === 0)) {
+   this.socket = socket;
+   } else  {
var wopiSrc = '';
if (map.options.wopiSrc != '') {
wopiSrc = '?WOPISrc=' + map.options.wopiSrc + 
'=/ws';
@@ -78,17 +80,13 @@ L.Socket = L.Class.extend({
this._accessTokenExpireTimeout = 
setTimeout(L.bind(this._sessionExpiredWarning, this),

parseInt(map.options.docParams.access_token_ttl) - Date.now() - 
tokenExpiryWarning);
}
-   },
 
-   attach: function (socket, msgQueue) {
-   this.socket = socket;
-   this.socket.onerror = L.bind(this._onSocketError, this);
-   this.socket.onclose = L.bind(this._onSocketClose, this);
-   this.socket.onopen = L.bind(this._onSocketOpen, this);
-   this.socket.onmessage = L.bind(this._onMessage, this);
-
-   for (var it = 0; it < msgQueue.length; it++) {
-   this._onMessage({data: msgQueue[it]});
+   // process messages for early socket connection
+   if (window.queueMsg && window.queueMsg.length > 0) {
+   for (var it = 0; it < window.queueMsg.length; it++) {
+   this._onMessage({data: window.queueMsg[it]});
+   }
+   window.queueMsg = [];
}
},
 
diff --git 

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

2019-03-07 Thread Libreoffice Gerrit user
 loleaflet/js/global.js |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 52b03a2d1a3a5ad817722da0662ac89e35545e01
Author: Henry Castro 
AuthorDate: Thu Mar 7 10:10:22 2019 -0400
Commit: Henry Castro 
CommitDate: Thu Mar 7 10:22:12 2019 -0400

loleaflet: verify if "toLocaleString" function exists

This API has not been standarized yet

Change-Id: I63e1ac88dc660675420af266766163dbe13d31ce

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 709935b33..f46f68a26 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -76,10 +76,14 @@
global._ = function (string) {
return string;
}
-   } else {
+   } else if (typeof String.prototype.toLocaleString === 'function') {
global._ = function (string) {
return string.toLocaleString();
}
+   } else {
+   global._ = function (string) {
+   return string;
+   }
}
 
var docParams, wopiParams;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-06 Thread Libreoffice Gerrit user
 loleaflet/js/global.js |4 
 1 file changed, 4 insertions(+)

New commits:
commit 29626c36a337b33276343f613f69fb4527cb757d
Author: Tor Lillqvist 
AuthorDate: Wed Mar 6 16:55:13 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Mar 6 17:00:01 2019 +0200

I was misinformed: The _ function *is* needed also in normal Online

Not all calls to the _ function are magically replaced by the
FileServer, but only those that pass an explicit string literal.

Change-Id: I9917c569f0471551ade9e46ee9f87b4f326f581e

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 3057361af..709935b33 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -76,6 +76,10 @@
global._ = function (string) {
return string;
}
+   } else {
+   global._ = function (string) {
+   return string.toLocaleString();
+   }
}
 
var docParams, wopiParams;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am

2019-03-06 Thread Libreoffice Gerrit user
 loleaflet/Makefile.am  |3 ++-
 loleaflet/js/global.js |   18 ++
 2 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 318efba0533487f7fc19f06f6341ca44228e3771
Author: Tor Lillqvist 
AuthorDate: Wed Mar 6 14:17:53 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Mar 6 14:17:53 2019 +0200

Try to make l10n work again in the iOS app

In real Online, after recent commits localisation of messages in our
JavaScript is handled in the FileServer code. Calls to the _ function
in JavaScript being served are replaced with the translated string. We
can't do that in the mobile apps (without some re-work, and I doubt we
want to spend time on that now, there are more pressing problems). In
real Online, the _ function in global.js thus actually dead code.

But in the mobile apps, we don't have any FileServer, and we do want
the _ function to work as before, and we do want to include the
l10n-all.js file in the bundle.js.

Of course, if profiling eventually indicates that doing that *is* a
problem from performance and/or memory usage point of view, we do need
to re-work this. But for now I just want things to roughly work as
they did in the iOS app.

Change-Id: Ib77020010867e7aabaf68bbb892d150d15708213

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 953add0c6..59c01a7ff 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -138,7 +138,6 @@ LANGUAGES = \
 
 if ENABLE_IOSAPP
 L10N_IOS_ALL_JS = $(builddir)/dist/l10n-all.js
-L10N_JSON = $(L10N_IOS_ALL_JS)
 
 $(L10N_IOS_ALL_JS) : $(wildcard $(srcdir)/po/ui-*.po) $(shell find 
$(srcdir)/l10n -name '*.*')
for F in $(wildcard $(srcdir)/po/ui-*.po); do \
@@ -265,6 +264,7 @@ ADMIN_BUNDLE = $(builddir)/dist/admin-bundle.js
 endif
 
 build-loleaflet: | \
+   $(L10N_IOS_ALL_JS) \
$(LOLEAFLET_MO_DST) \
$(LOLEAFLET_IMAGES_DST) \
$(JQUERY_LIGHTNESS_DIST_IMAGES) \
@@ -348,6 +348,7 @@ $(builddir)/dist/bundle.js: $(NODE_MODULES_JS_SRC) \
$(srcdir)/js/main.js
@echo "Uglify loleaflet js files..."
NODE_PATH=$(abs_builddir)/node_modules $(NODE) 
node_modules/uglify-js/bin/uglifyjs \
+   $(L10N_IOS_ALL_JS) \
$(NODE_MODULES_JS) \
$(srcdir)/js/jquery.mCustomScrollbar.js \
$(srcdir)/js/w2ui-1.5.rc1.js \
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index d7cbc3413..bc1e96e05 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -53,9 +53,11 @@
String.locale = 'en';
}
 
-   global._ = function (string) {
-   // In the mobile app case we can't use the stuff from 
l10n-for-node, as that assumes HTTP.
-   if (window.ThisIsTheiOSApp) {
+   // In the mobile app case we don't use any "server-side" localisation. 
For real Online, what
+   // looks like calls to a _ function are in fact replaced by Online's 
file server with the
+   // translation.
+   if (window.ThisIsTheiOSApp) {
+   global._ = function (string) {
// We use another approach just for iOS for now.
if (window.LOCALIZATIONS.hasOwnProperty(string)) {
// window.postMobileDebug('_(' + string + '): 
YES: ' + window.LOCALIZATIONS[string]);
@@ -68,13 +70,13 @@
// window.postMobileDebug('_(' + string + '): 
NO');
return string;
}
-   } else if (window.ThisIsAMobileApp) {
-   // And bail out without translations on other mobile 
platforms.
+   }
+   } else if (window.ThisIsAMobileApp) {
+   // Bail out without translations on other mobile platforms for 
now.
+   global._ = function (string) {
return string;
-   } else {
-   return string.toLocaleString();
}
-   };
+   }
 
var docParams, wopiParams;
var filePath = global.getParameterByName('file_path');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/Makefile.am  |4 +---
 loleaflet/js/global.js |8 
 2 files changed, 1 insertion(+), 11 deletions(-)

New commits:
commit e81441f63bb19981fa5a47b0fd251a91a8b98c1f
Author: Henry Castro 
AuthorDate: Tue Feb 12 09:56:45 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 23:42:24 2019 -0400

loleaflet: remove jquery-ui.js

This library is not used, reduce bundle size

Change-Id: I925ed1335a46f78ba74af55582261a86376d7aca

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 81d8c4614..697877b67 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -212,8 +212,7 @@ LOLEAFLET_CSS =\
$(builddir)/node_modules/vex-js/css/vex-theme-bottom-right-corner.css \
$(builddir)/node_modules/smartmenus/dist/css/sm-core-css.css \
$(builddir)/node_modules/smartmenus/dist/css/sm-simple/sm-simple.css \
-   $(srcdir)/css/menubar.css \
-   $(builddir)/node_modules/jquery-ui/themes/ui-lightness/jquery-ui.css
+   $(srcdir)/css/menubar.css
 
 LOLEAFLET_CSS_DST = $(foreach file,$(LOLEAFLET_CSS),$(builddir)/dist/$(notdir 
$(file)))
 LOLEAFLET_CSS_M4 = $(strip $(foreach file,$(LOLEAFLET_CSS),$(notdir $(file
@@ -232,7 +231,6 @@ NODE_MODULES_JS =\
node_modules/jquery/dist/jquery.js \
node_modules/jquery-mousewheel/jquery.mousewheel.js \
node_modules/jquery-contextmenu/dist/jquery.contextMenu.js \
-   node_modules/jquery-ui/jquery-ui.js \
node_modules/smartmenus/dist/jquery.smartmenus.js \
node_modules/timeago/jquery.timeago.js \
node_modules/timeago.js/dist/timeago.min.js \
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index b6b1c7bd4..ea2933d73 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -11,14 +11,6 @@
}
}
 
-   // fix jquery-ui
-   // var jQuery = require('jquery');
-   global.require = function (path) {
-   if (path=='jquery') {
-   return global.jQuery;
-   }
-   };
-
global.getParameterByName = function (name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + 

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/global.js |8 
 1 file changed, 8 insertions(+)

New commits:
commit 304852ccd5ad8086d43728c830534eb53ac191dc
Author: Henry Castro 
AuthorDate: Sun Feb 10 19:15:25 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 22:05:51 2019 -0400

loleaflet: fix String.locale assignment

Change-Id: I901f635ef2cb176329ef8e836a5314efabbc026b

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index d384409f0..b6b1c7bd4 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -26,6 +26,14 @@
return results === null ? '' : results[1].replace(/\+/g, ' ');
};
 
+   var lang = self.getParameterByName('lang');
+   if (lang) {
+   String.locale = lang;
+   }
+   else {
+   String.locale = 'en';
+   }
+
global._ = function (string) {
// In the mobile app case we can't use the stuff from 
l10n-for-node, as that assumes HTTP.
if (window.ThisIsTheiOSApp) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/l10n.js   |9 -
 loleaflet/src/errormessages.js |7 +--
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 668b837c70b1d2e8d13d97c173b7a8131fc75a04
Author: Henry Castro 
AuthorDate: Thu Jan 31 15:35:59 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 15:11:33 2019 -0400

loleaflet: load l10n files according to parameter "lang"

Change-Id: I28e6aafa7446b2ea1edbb42bddb77d6d36e68983

diff --git a/loleaflet/js/l10n.js b/loleaflet/js/l10n.js
index 0057eed74..d9ca75506 100644
--- a/loleaflet/js/l10n.js
+++ b/loleaflet/js/l10n.js
@@ -18,6 +18,7 @@ var
   undef_type = "undefined"
 , string_type = "string"
 , nav = {}
+, lang = {}
 , String_ctr = String
 , has_own_prop = Object.prototype.hasOwnProperty
 , load_queues = {}
@@ -188,6 +189,7 @@ var
 try
 {
 nav = self.navigator;
+lang = self.getParameterByName('lang');
 }
 catch(selfNotFoundException)
 {
@@ -240,7 +242,7 @@ if (!browserless && typeof XMLHttpRequest === undef_type && 
typeof ActiveXObject
 }
 
 String_ctr[$default_locale] = String_ctr[$default_locale] || "";
-String_ctr[$locale] = nav && (nav.language || nav.userLanguage) || "";
+String_ctr[$locale] = nav && lang && (lang) || "en";
 
 if (!browserless || typeof document !== undef_type) {
var
@@ -268,6 +270,11 @@ if (!browserless || typeof document !== undef_type) {
}
}
}
+
+   load(self.__globalL10n);
+   load(self.__locoreL10n);
+   load(self.__helpL10n);
+   load(self.__unoL10n);
 }
 else
 {
diff --git a/loleaflet/src/errormessages.js b/loleaflet/src/errormessages.js
index 3381b9126..c2ac2dd74 100644
--- a/loleaflet/src/errormessages.js
+++ b/loleaflet/src/errormessages.js
@@ -1,15 +1,10 @@
 /* -*- js-indent-level: 8 -*- */
 
-/* global vex _ getParameterByName */
+/* global vex _ */
 var errorMessages = {};
 
 vex.defaultOptions.className = 'vex-theme-plain';
 
-var lang = getParameterByName('lang');
-if (lang) {
-   String.locale = lang;
-}
-
 errorMessages.diskfull = _('No disk space left on server, please contact the 
server administrator to continue.');
 errorMessages.emptyhosturl = _('The host URL is empty. The loolwsd server is 
probably misconfigured, please contact the administrator.');
 errorMessages.limitreached = _('This is an unsupported version of 
{productname}. To avoid the impression that it is suitable for deployment in 
enterprises, this message appears when more than {docs} documents or 
{connections} connections are in use concurrently');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/l10n.js |  568 +--
 1 file changed, 284 insertions(+), 284 deletions(-)

New commits:
commit ab2051cd50dc4b1bb6e579fbad15afea5a9cedf1
Author: Henry Castro 
AuthorDate: Wed Jan 30 16:16:07 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 14:38:33 2019 -0400

loleaflet: set format unix l10n.js

Change-Id: Ib5412e83b049954cb0ee56ea91f03289f539175a

diff --git a/loleaflet/js/l10n.js b/loleaflet/js/l10n.js
index 4beab6e7a..0057eed74 100644
--- a/loleaflet/js/l10n.js
+++ b/loleaflet/js/l10n.js
@@ -1,284 +1,284 @@
-/*
- * l10n.js
- * 2016-05-17
- * 
- * By Eli Grey, http://eligrey.com
- * Licensed under the MIT License
- *   See https://github.com/eligrey/l10n.js/blob/master/LICENSE.md
- */
-
-/*global XMLHttpRequest, setTimeout, document, navigator, ActiveXObject*/
-
-/*! @source http://purl.eligrey.com/github/l10n.js/blob/master/l10n.js*/
-
-(function () {
-"use strict";
-
-var
-  undef_type = "undefined"
-, string_type = "string"
-, nav = {}
-, String_ctr = String
-, has_own_prop = Object.prototype.hasOwnProperty
-, load_queues = {}
-, localizations = {}
-, FALSE = !1
-, TRUE = !0
-, browserless = FALSE
-// the official format is application/vnd.oftn.l10n+json, though l10n.js will 
also
-// accept application/x-l10n+json and application/l10n+json
-, l10n_js_media_type = 
/^\s*application\/(?:vnd\.oftn\.|x-)?l10n\+json\s*(?:$|;)/i
-, XHR
-
-// property minification aids
-, $locale = "locale"
-, $default_locale = "defaultLocale"
-, $to_locale_string = "toLocaleString"
-, $to_lowercase = "toLowerCase"
-
-, array_index_of = Array.prototype.indexOf || function (item) {
-   var
- len = this.length
-   , i   = 0
-   ;
-   
-   for (; i < len; i++) {
-   if (i in this && this[i] === item) {
-   return i;
-   }
-   }
-   
-   return -1;
-}
-, request_JSON = function (uri) {
-if(browserless)
-return loadFromDisk(uri);
-
-   var req  = new XHR(),
-   data = {};
-   
-   // sadly, this has to be blocking to allow for a graceful degrading API
-   req.open("GET", uri, FALSE);
-   req.send(null);
-   
-   // Status codes can be inconsistent across browsers so we simply try to 
parse
-   // the response text and catch any errors. This deals with failed 
requests as
-   // well as malformed json files.
-   try {
-   data = JSON.parse(req.responseText);
-   } catch(e) {
-   // warn about error without stopping execution
-   setTimeout(function () {
-   // Error messages are not localized as not to cause an 
infinite loop
-   var l10n_err = new Error("Unable to load localization 
data: " + uri);
-   l10n_err.name = "Localization Error";
-   throw l10n_err;
-   }, 0);
-   }
-
-   return data;
-}
-, load = String_ctr[$to_locale_string] = function (data) {
-   // don't handle function.toLocaleString(indentationAmount:Number)
-   if (arguments.length > 0 && typeof data !== "number") {
-   if (typeof data === string_type) {
-   load(request_JSON(data));
-   } else if (data === FALSE) {
-   // reset all localizations
-   localizations = {};
-   } else {
-   // Extend current localizations instead of completely 
overwriting them
-   var locale, localization, message;
-   for (locale in data) {
-   if (has_own_prop.call(data, locale)) {
-   localization = data[locale];
-   locale = locale[$to_lowercase]();
-   
-   if (!(locale in localizations) || 
localization === FALSE) {
-   // reset locale if not existing 
or reset flag is specified
-   localizations[locale] = {};
-   }
-   
-   if (localization === FALSE) {
-   continue;
-   }
-   
-   // URL specified
-   if (typeof localization === 
string_type) {
-   if 
(String_ctr[$locale][$to_lowercase]().indexOf(locale) === 0) {
-   localization = 
request_JSON(localization);
-   } else {
-   // queue loading locale 
if 

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/global.js |   82 +++--
 1 file changed, 40 insertions(+), 42 deletions(-)

New commits:
commit 032703ca164f7e363f153ef82f46e8f697902324
Author: Henry Castro 
AuthorDate: Sat Jan 26 17:21:48 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 10:15:44 2019 -0400

loleaflet: indent global.js

Change-Id: Ib04a18bcedb26ce267a80fd7990454f590de1a3d

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 53f58d659..a294ffae8 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -1,54 +1,52 @@
 /* -*- js-indent-level: 8 -*- */
-/* global loleafletLogging */
-/*eslint indent: [error, "tab", { "outerIIFEBody": 0 }]*/
 (function (global) {
 
-// If not debug, don't print anything on the console
-// except in tile debug mode (Ctrl-Shift-Alt-d)
-console.log2 = console.log;
-if (loleafletLogging !== 'true') {
-   var methods = ['warn', 'info', 'debug', 'trace', 'log', 'assert', 
'time', 'timeEnd'];
-   for (var i = 0; i < methods.length; i++) {
-   console[methods[i]] = function() {};
+   // If not debug, don't print anything on the console
+   // except in tile debug mode (Ctrl-Shift-Alt-d)
+   console.log2 = console.log;
+   if (global.loleafletLogging !== 'true') {
+   var methods = ['warn', 'info', 'debug', 'trace', 'log', 
'assert', 'time', 'timeEnd'];
+   for (var i = 0; i < methods.length; i++) {
+   console[methods[i]] = function() {};
+   }
}
-}
 
-// fix jquery-ui
-// var jQuery = require('jquery');
-global.require = function (path) {
-   if (path=='jquery') {
-   return global.jQuery;
-   }
-};
+   // fix jquery-ui
+   // var jQuery = require('jquery');
+   global.require = function (path) {
+   if (path=='jquery') {
+   return global.jQuery;
+   }
+   };
 
-global.getParameterByName = function (name) {
-   name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
-   var regex = new RegExp('[\\?&]' + name + 

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit 776210963656a80b3979e471abb42e6869af4d2b
Author: Henry Castro 
AuthorDate: Tue Jan 15 16:18:55 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 09:09:44 2019 -0400

loleaflet: export toolbar global functions

Change-Id: I981dbbd83fa782cdae773d1364e5a2f27cdb97ef

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 4188d67a9..2f809ddc0 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -2395,5 +2395,19 @@ function setupToolbar(e) {
 }
 
 global.setupToolbar = setupToolbar;
+global.onClick = onClick;
+global.hideTooltip = hideTooltip;
+global.deselectUser = deselectUser;
+global.onAddView = onAddView;
+global.onRemoveView = onRemoveView;
+global.onAddressInput = onAddressInput;
+global.onFormulaInput = onFormulaInput;
+global.onFormulaBarBlur = onFormulaBarBlur;
+global.onFormulaBarFocus = onFormulaBarFocus;
+global.updateCommandValues = updateCommandValues;
+global.onStyleSelect = onStyleSelect;
+global.insertTable = insertTable;
+global.insertShapes = insertShapes;
+global.onUpdatePermission = onUpdatePermission;
 
 }(window));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit fcabb821bebd6bea226befd2e9a6c8193d3bdb1d
Author: Henry Castro 
AuthorDate: Tue Jan 15 16:17:03 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 09:04:51 2019 -0400

loleaflet: move toolItems variable to initNormalToolbar function

Change-Id: I8dda1cecf66a4c720c110fe146cd058570ee158d

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index ecabe1bb4..4188d67a9 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -666,6 +666,16 @@ var fontsizesSelectValue;
 // mobilebrowser:false means hide it for normal Online used from a mobile 
browser, but don't hide it in a mobile app
 
 function createToolbar() {
+
+   if (_inMobileMode()) {
+   $('#mobile-edit-button').show();
+   } else {
+   $('#toolbar-down').show();
+   initNormalToolbar();
+   }
+}
+
+function initNormalToolbar() {
var toolItems = [
{type: 'button',  id: 'closemobile',  img: 'closemobile', 
desktop: false, mobile: false, tablet: true, hidden: true},
{type: 'button',  id: 'save', img: 'save', hint: 
_UNO('.uno:Save')},
@@ -814,15 +824,6 @@ function createToolbar() {
{type: 'button',  id: 'hamburger-tablet',  img: 'hamburger', 
desktop: false, mobile: false, tablet: true, hidden: true}
];
 
-   if (_inMobileMode()) {
-   $('#mobile-edit-button').show();
-   } else {
-   $('#toolbar-down').show();
-   initNormalToolbar(toolItems);
-   }
-}
-
-function initNormalToolbar(toolItems) {
var toolbar = $('#toolbar-up');
toolbar.w2toolbar({
name: 'editbar',
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |  180 
 1 file changed, 180 deletions(-)

New commits:
commit db5d847d82b9a433099409070a2ed2cd88696b34
Author: Henry Castro 
AuthorDate: Tue Jan 15 16:13:37 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 08:57:15 2019 -0400

loleaflet: remove initMobileToolbar function

Change-Id: Ia99879fe8986e19d41a7add2be649b100bfb2f5d

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 51fb07db0..ecabe1bb4 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -816,192 +816,12 @@ function createToolbar() {
 
if (_inMobileMode()) {
$('#mobile-edit-button').show();
-   initMobileToolbar(toolItems);
} else {
$('#toolbar-down').show();
initNormalToolbar(toolItems);
}
 }
 
-function initMobileToolbar(toolItems) {
-   var toolbar = $('#toolbar-up');
-   toolbar.w2toolbar({
-   name: 'actionbar',
-   tooltip: 'bottom',
-   items: [
-   {type: 'button',  id: 'closemobile',  img: 
'closemobile'},
-   {type: 'spacer'},
-   {type: 'button',  id: 'prev', img: 'prev', hint: 
_UNO('.uno:PageUp', 'text'), hidden: true},
-   {type: 'button',  id: 'next', img: 'next', hint: 
_UNO('.uno:PageDown', 'text'), hidden: true},
-   {type: 'button',  id: 'undo',  img: 'undo', hint: 
_UNO('.uno:Undo'), uno: 'Undo', disabled: true},
-   {type: 'button',  id: 'redo',  img: 'redo', hint: 
_UNO('.uno:Redo'), uno: 'Redo', disabled: true},
-   {type: 'button',  id: 'fullscreen', img: 'fullscreen', 
hint: _UNO('.uno:FullScreen', 'text')},
-   {type: 'drop', id: 'userlist', img: 'users', hidden: 
true, html: '' +
-   '' +
-   '' +
-   '' +
-   '' + _('Always follow the editor') + 
'' +
-   '' +
-   '' +
-   '' + _('Current') + ' - 
' +
-   ''
-   },
-   ],
-   onClick: function (e) {
-   onClick(e, e.target);
-   hideTooltip(this, e.target);
-   },
-   onRefresh: function() {
-   var showUserList = map['wopi'].HideUserList !== null &&
-   
map['wopi'].HideUserList !== undefined &&
-   
$.inArray('true', map['wopi'].HideUserList) < 0 &&
-   
((window.mode.isMobile() && $.inArray('mobile', map['wopi'].HideUserList) < 0) 
||
-   
(window.mode.isTablet() && $.inArray('tablet', map['wopi'].HideUserList) < 0));
-   if (this.get('userlist').hidden == true && 
showUserList) {
-   this.show('userlist');
-   this.show('userlistbreak');
-   map.on('deselectuser', deselectUser);
-   map.on('addview', onAddView);
-   map.on('removeview', onRemoveView);
-   }
-   }
-   });
-   toolbar.bind('touchstart', function(e) {
-   w2ui['actionbar'].touchStarted = true;
-   var touchEvent = e.originalEvent;
-   if (touchEvent && touchEvent.touches.length > 1) {
-   L.DomEvent.preventDefault(e);
-   }
-   });
-
-   toolbar = $('#formulabar');
-   toolbar.w2toolbar({
-   name: 'formulabar',
-   tooltip: 'bottom',
-   hidden: true,
-   items: [
-   {type: 'html',  id: 'left'},
-   {type: 'html', id: 'address', html: ''},
-   {type: 'break'},
-   {type: 'button',  id: 'sum',  img: 'autosum', hint: 
_('Sum')},
-   {type: 'button',  id: 'function',  img: 'equal', hint: 
_('Function')},
-   {type: 'button', hidden: true, id: 'cancelformula',  
img: 'cancel', hint: _('Cancel')},
-   {type: 'button', hidden: true, id: 'acceptformula',  
img: 'accepttrackedchanges', hint: _('Accept')},
-   {type: 'html', id: 'formula', html: ''}
-   ],
-   onClick: function (e) {
-   onClick(e, e.target);
-   hideTooltip(this, e.target);
-   },
-   onRefresh: function() {
-   $('#addressInput').off('keyup', 

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   31 +--
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit 8418d43e8974350c84f25bc8d0d21d9688d33a8e
Author: Henry Castro 
AuthorDate: Tue Jan 15 16:09:47 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 08:49:34 2019 -0400

loleaflet: filter mobile toolbar event listeners

Change-Id: Iba4fc6f81b6efa5aae15f7964037e490385d2adb

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index b8587e79c..51fb07db0 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -2547,24 +2547,27 @@ function setupToolbar(e) {
}
});
 
-   map.on('updatetoolbarcommandvalues', function() {
-   w2ui['editbar'].refresh();
-   });
 
-   map.on('showbusy', function(e) {
-   w2utils.lock(w2ui['actionbar'].box, e.label, true);
-   });
+   if (!window.mode.isMobile()) {
+   map.on('updatetoolbarcommandvalues', function() {
+   w2ui['editbar'].refresh();
+   });
 
-   map.on('hidebusy', function() {
-   // If locked, unlock
-   if (w2ui['actionbar'].box.firstChild.className === 'w2ui-lock') 
{
-   w2utils.unlock(w2ui['actionbar'].box);
-   }
-   });
+   map.on('showbusy', function(e) {
+   w2utils.lock(w2ui['actionbar'].box, e.label, true);
+   });
 
-   map.on('doclayerinit', onDocLayerInit);
+   map.on('hidebusy', function() {
+   // If locked, unlock
+   if (w2ui['actionbar'].box.firstChild.className === 
'w2ui-lock') {
+   w2utils.unlock(w2ui['actionbar'].box);
+   }
+   });
+
+   map.on('doclayerinit', onDocLayerInit);
+   map.on('updatepermission', onUpdatePermission);
+   }
map.on('wopiprops', onWopiProps);
-   map.on('updatepermission', onUpdatePermission);
map.on('commandresult', onCommandResult);
map.on('updateparts pagenumberchanged', onUpdateParts);
map.on('commandstatechanged', onCommandStateChanged);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |  103 
 1 file changed, 62 insertions(+), 41 deletions(-)

New commits:
commit c81529120d92dfc164537516f23f5108e9fbbba4
Author: Henry Castro 
AuthorDate: Tue Jan 15 14:11:09 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 08:36:00 2019 -0400

loleaflet: check if a toolbar object exists

Change-Id: I15803a8dea8d13543c10610f1048ae25c73dd296

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index a04a67cd4..b8587e79c 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -2074,6 +2074,10 @@ function onUpdateParts(e) {
}
 
var toolbar = w2ui['actionbar'];
+   if (!toolbar) {
+   return;
+   }
+
if (e.docType === 'presentation') {
toolbar.set('prev', {hint: _('Previous slide')});
toolbar.set('next', {hint: _('Next slide')});
@@ -2128,24 +2132,25 @@ function onCommandResult(e) {
 
 function onUpdatePermission(e) {
var toolbar = w2ui['editbar'];
-
-   // always enabled items
-   var enabledButtons = ['closemobile', 'undo', 'redo'];
-
-   // copy the first array
-   var items = toolbar.items.slice();
-   for (var idx in items) {
-   var found = enabledButtons.filter(function(id) { return id === 
items[idx].id });
-   var alwaysEnable = found.length !== 0;
-
-   if (e.perm === 'edit') {
-   var unoCmd = map.getDocType() === 'spreadsheet' ? 
items[idx].unosheet : items[idx].uno;
-   var keepDisabled = 
map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled';
-   if (!keepDisabled || alwaysEnable) {
-   toolbar.enable(items[idx].id);
+   if (toolbar) {
+   // always enabled items
+   var enabledButtons = ['closemobile', 'undo', 'redo'];
+
+   // copy the first array
+   var items = toolbar.items.slice();
+   for (var idx in items) {
+   var found = enabledButtons.filter(function(id) { return 
id === items[idx].id });
+   var alwaysEnable = found.length !== 0;
+
+   if (e.perm === 'edit') {
+   var unoCmd = map.getDocType() === 'spreadsheet' 
? items[idx].unosheet : items[idx].uno;
+   var keepDisabled = 
map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled';
+   if (!keepDisabled || alwaysEnable) {
+   toolbar.enable(items[idx].id);
+   }
+   } else if (!alwaysEnable) {
+   toolbar.disable(items[idx].id);
}
-   } else if (!alwaysEnable) {
-   toolbar.disable(items[idx].id);
}
}
 
@@ -2163,24 +2168,32 @@ function onUpdatePermission(e) {
$('#addressInput').prop('disabled', false);
$('#formulaInput').prop('disabled', false);
toolbar = w2ui.formulabar;
-   formulaBarButtons.forEach(function(id) {
-   toolbar.enable(id);
-   });
+   if (toolbar) {
+   formulaBarButtons.forEach(function(id) {
+   toolbar.enable(id);
+   });
+   }
 
toolbar = w2ui['spreadsheet-toolbar'];
-   spreadsheetButtons.forEach(function(id) {
-   toolbar.enable(id);
-   });
+   if (toolbar) {
+   spreadsheetButtons.forEach(function(id) {
+   toolbar.enable(id);
+   });
+   }
 
toolbar = w2ui['presentation-toolbar'];
-   presentationButtons.forEach(function(id) {
-   toolbar.enable(id);
-   });
+   if (toolbar) {
+   presentationButtons.forEach(function(id) {
+   toolbar.enable(id);
+   });
+   }
 
toolbar = w2ui['actionbar'];
-   toolbarDownButtons.forEach(function(id) {
-   toolbar.enable(id);
-   });
+   if (toolbar) {
+   toolbarDownButtons.forEach(function(id) {
+   toolbar.enable(id);
+   });
+   }
$('#search-input').prop('disabled', false);
 
// FIXME avoid hardcoding this stuff if possible
@@ -2212,24 +2225,32 @@ function onUpdatePermission(e) {
$('#formulaInput').prop('disabled', true);
 
toolbar = w2ui.formulabar;
-   formulaBarButtons.forEach(function(id) {
-   

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/main.js  |3 ---
 loleaflet/src/layer/tile/CalcTileLayer.js |3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 7e9204f02434e2a2238fee00c0d6aa6c49941f2d
Author: Henry Castro 
AuthorDate: Tue Jan 15 17:43:33 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 08:21:25 2019 -0400

loleaflet: row/column control belongs to CalcTileLayer

Change-Id: I2c5f43bd74f6d7151c21152ab2b86d8065a96ce5

diff --git a/loleaflet/js/main.js b/loleaflet/js/main.js
index 7eefaf251..67d88d714 100644
--- a/loleaflet/js/main.js
+++ b/loleaflet/js/main.js
@@ -73,9 +73,6 @@ setupToolbar(map);
 map.addControl(L.control.scroll());
 map.addControl(L.control.alertDialog());
 map.addControl(L.control.lokDialog());
-map.addControl(L.control.tabs());
-map.addControl(L.control.columnHeader());
-map.addControl(L.control.rowHeader());
 map.addControl(L.control.contextMenu());
 map.addControl(L.control.infobar());
 map.loadDocument();
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index b616155b0..647670a47 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -54,6 +54,9 @@ L.CalcTileLayer = L.TileLayer.extend({
},
 
onAdd: function (map) {
+   map.addControl(L.control.tabs());
+   map.addControl(L.control.columnHeader());
+   map.addControl(L.control.rowHeader());
L.TileLayer.prototype.onAdd.call(this, map);
this._annotations = {};
},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-05 Thread Libreoffice Gerrit user
 loleaflet/js/main.js |1 -
 loleaflet/src/layer/tile/ImpressTileLayer.js |1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1d63970f60bff6d76283b3d2e6376d041264499b
Author: Henry Castro 
AuthorDate: Tue Jan 15 11:54:05 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Mar 5 08:16:24 2019 -0400

loleaflet: preview slide control belongs to ImpressTileLayer

Change-Id: Id3d7ababdae71fe5794a5762a3b269cc92b797ec

diff --git a/loleaflet/js/main.js b/loleaflet/js/main.js
index 15e859606..7eefaf251 100644
--- a/loleaflet/js/main.js
+++ b/loleaflet/js/main.js
@@ -73,7 +73,6 @@ setupToolbar(map);
 map.addControl(L.control.scroll());
 map.addControl(L.control.alertDialog());
 map.addControl(L.control.lokDialog());
-map.addControl(L.control.partsPreview());
 map.addControl(L.control.tabs());
 map.addControl(L.control.columnHeader());
 map.addControl(L.control.rowHeader());
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 5240e3b89..ceccc1696 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -83,6 +83,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
},
 
onAdd: function (map) {
+   map.addControl(L.control.partsPreview());
L.TileLayer.prototype.onAdd.call(this, map);
this._annotations = {};
this._topAnnotation = [];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-27 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js   |2 +-
 loleaflet/src/control/Ruler.js|   24 +---
 loleaflet/src/map/handler/Map.FileInserter.js |8 ++--
 3 files changed, 20 insertions(+), 14 deletions(-)

New commits:
commit ba8391af68ad0a206d94e23512c3daaf22a79a46
Author: merttumer 
AuthorDate: Tue Feb 19 20:30:52 2019 +0300
Commit: Szymon Kłos 
CommitDate: Wed Feb 27 16:25:56 2019 +0100

Fix not able to insert image after new file from template

On Nextcloud, when creating a new document with template
in the first run, document does not load images or run saveAs
functions
Change-Id: I01611cbf66052cb80dece1d3ce06c238a23d2e2e
Signed-off-by: merttumer 
Reviewed-on: https://gerrit.libreoffice.org/68028
(cherry picked from commit e1b0096bd1ac83e10735601f0bf2a70c0f3b0bac)
Reviewed-on: https://gerrit.libreoffice.org/68449
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index fbe7c0905..730438f42 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1032,7 +1032,7 @@ function initNormalToolbar(toolItems) {
}
}
 
-   if (event.target === 'styles' || event.target === 
'fonts' || event.target === 'fontsizes') {
+   if ((event.target === 'styles' || event.target === 
'fonts' || event.target === 'fontsizes') && event.item) {
var toolItem = $(this.box).find('#tb_'+ 
this.name +'_item_'+ w2utils.escapeId(event.item.id));
if ((_inDesktopMode() && event.item.desktop == 
false)
|| (_inTabletMode() && 
event.item.tablet == false)) {
diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index 95ec5143b..a48dacb6f 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -39,19 +39,21 @@ L.Control.Ruler = L.Control.extend({
},
 
_changeInteractions: function(e) {
-   if (e.perm === 'edit') {
-   this._lMarginDrag.style.cursor = 'e-resize';
-   this._rMarginDrag.style.cursor = 'w-resize';
+   if (this._lMarginDrag) {
+   if (e.perm === 'edit') {
+   this._lMarginDrag.style.cursor = 'e-resize';
+   this._rMarginDrag.style.cursor = 'w-resize';
 
-   L.DomEvent.on(this._rMarginDrag, 'mousedown', 
this._initiateDrag, this);
-   L.DomEvent.on(this._lMarginDrag, 'mousedown', 
this._initiateDrag, this);
-   }
-   else {
-   this._lMarginDrag.style.cursor = 'default';
-   this._rMarginDrag.style.cursor = 'default';
+   L.DomEvent.on(this._rMarginDrag, 'mousedown', 
this._initiateDrag, this);
+   L.DomEvent.on(this._lMarginDrag, 'mousedown', 
this._initiateDrag, this);
+   }
+   else {
+   this._lMarginDrag.style.cursor = 'default';
+   this._rMarginDrag.style.cursor = 'default';
 
-   L.DomEvent.off(this._rMarginDrag, 'mousedown', 
this._initiateDrag, this);
-   L.DomEvent.off(this._lMarginDrag, 'mousedown', 
this._initiateDrag, this);
+   L.DomEvent.off(this._rMarginDrag, 'mousedown', 
this._initiateDrag, this);
+   L.DomEvent.off(this._lMarginDrag, 'mousedown', 
this._initiateDrag, this);
+   }
}
},
 
diff --git a/loleaflet/src/map/handler/Map.FileInserter.js 
b/loleaflet/src/map/handler/Map.FileInserter.js
index 91a51e786..a2047d41b 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -18,11 +18,14 @@ L.Map.FileInserter = L.Handler.extend({
this._toInsertURL = {};
var parser = document.createElement('a');
parser.href = map.options.server;
+   },
+
+   getWopiUrl: function (map) {
var wopiSrc = '';
if (map.options.wopiSrc != '') {
wopiSrc = '?WOPISrc=' + map.options.wopiSrc;
}
-   this._url = map.options.webserver + map.options.serviceRoot + 
'/' + map.options.urlPrefix +
+   return map.options.webserver + map.options.serviceRoot + '/' + 
map.options.urlPrefix +
'/' + encodeURIComponent(map.options.doc) + 
'/insertfile' + wopiSrc;
},
 
@@ -72,9 +75,10 @@ L.Map.FileInserter = L.Handler.extend({
},
 
_sendFile: function (name, file) {
-   var url = this._url;
var socket = 

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

2019-02-26 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 3106294772329f7560a6a750b0ca5d5e861549af
Author: Ashod Nakashian 
AuthorDate: Tue Feb 5 22:44:32 2019 -0500
Commit: Szymon Kłos 
CommitDate: Tue Feb 26 14:25:34 2019 +0100

leaflet: enable toolbar buttons only when editing

When the uno command state is changed, we shouldn't
enable toolbar buttons if we aren't in edit mode yet.

Change-Id: I0cd99e430439ce278bd21a3cda295dfca22660e8
Reviewed-on: https://gerrit.libreoffice.org/67996
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 
(cherry picked from commit 0234dad4750a8101ad9afbbd33e85574954379a7)
Reviewed-on: https://gerrit.libreoffice.org/67504

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index fd8470af2..fbe7c0905 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1921,11 +1921,15 @@ function onCommandStateChanged(e) {
 
var id = unoCmdToToolbarId(commandName);
if (state === 'true') {
-   toolbar.enable(id);
+   if (map._permission === 'edit') {
+   toolbar.enable(id);
+   }
toolbar.check(id);
}
else if (state === 'false') {
-   toolbar.enable(id);
+   if (map._permission === 'edit') {
+   toolbar.enable(id);
+   }
toolbar.uncheck(id);
}
// Change the toolbar button states if we are in editmode
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-26 Thread Libreoffice Gerrit user
 loleaflet/js/w2ui-1.5.rc1.js |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 8494d9c4b1b56ce1fd55a610d49ab9eb1662e6a5
Author: Ashod Nakashian 
AuthorDate: Tue Feb 5 08:06:53 2019 -0500
Commit: Szymon Kłos 
CommitDate: Tue Feb 26 14:24:32 2019 +0100

leaflet: account for rounding error when scrolling toolbar

On some mobile browsers (Chrome) we get the maximum scroll
value that is 0.5 less than the real maximum, so we always
think we still have room to scroll more right. This
has the undesirable side-effect of keeping the >> button
visible, even when there is no way to scroll further right.

This allows for at most 1 pixel error.

Change-Id: Ie2e8902f1e2f4f358f210e9b0236422bc4f1da00
Reviewed-on: https://gerrit.libreoffice.org/67995
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 
(cherry picked from commit 01540059319258778dde4d5c9b26e811b979e1c2)
Reviewed-on: https://gerrit.libreoffice.org/67503

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 023587e95..fbbcc3d63 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -13086,7 +13086,8 @@ var w2prompt = function (label, title, callBack) {
 if (scrollBox.scrollLeft() > 0) {
 box.find('.w2ui-scroll-left').show();
 }
-if (scrollBox.scrollLeft() < 
scrollBox.find(':first').outerWidth() - scrollBox.outerWidth()) {
+// Allow for rounding errors (on mobile, the max scrollLeft we 
get is 0.5 less than the real max).
+if (scrollBox.scrollLeft() < 
scrollBox.find(':first').outerWidth() - scrollBox.outerWidth() - 1) {
 box.find('.w2ui-scroll-right').show();
 }
 }
@@ -13790,7 +13791,8 @@ var w2prompt = function (label, title, callBack) {
 if (scrollBox.scrollLeft() > 0) {
 box.find('.w2ui-scroll-left').show();
 }
-if (scrollBox.scrollLeft() < 
scrollBox.find(':first').outerWidth() - scrollBox.outerWidth()) {
+// Allow for rounding errors (on mobile, the max scrollLeft we 
get is 0.5 less than the real max).
+if (scrollBox.scrollLeft() < 
scrollBox.find(':first').outerWidth() - scrollBox.outerWidth() - 1) {
 box.find('.w2ui-scroll-right').show();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-26 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a850ede6f119917b85866a8db9f45c577d4fa4b0
Author: Ashod Nakashian 
AuthorDate: Tue Feb 5 22:45:59 2019 -0500
Commit: Szymon Kłos 
CommitDate: Tue Feb 26 14:24:08 2019 +0100

leaflet: check for disabled commands when editing only

Change-Id: Iaad2ec7084579f4b4b1f9303258ecb651245b738
Reviewed-on: https://gerrit.libreoffice.org/67997
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 
(cherry picked from commit df2632e6e11db2ff3e4568ac81737799ef13147c)
Reviewed-on: https://gerrit.libreoffice.org/67505

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index a90b5169c..fd8470af2 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -2131,9 +2131,9 @@ function onUpdatePermission(e) {
var found = enabledButtons.filter(function(id) { return id === 
items[idx].id });
var alwaysEnable = found.length !== 0;
 
-   var unoCmd = map.getDocType() === 'spreadsheet' ? 
items[idx].unosheet : items[idx].uno;
-   var keepDisabled = 
map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled';
if (e.perm === 'edit') {
+   var unoCmd = map.getDocType() === 'spreadsheet' ? 
items[idx].unosheet : items[idx].uno;
+   var keepDisabled = 
map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled';
if (!keepDisabled || alwaysEnable) {
toolbar.enable(items[idx].id);
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-06 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7da50d36202f3eb971e4d3adfb0487574d50e150
Author: Henry Castro 
AuthorDate: Mon Feb 4 15:18:23 2019 -0400
Commit: Henry Castro 
CommitDate: Wed Feb 6 08:55:39 2019 -0400

loleaflet: calc: show 'merge cells' to the toolbar

Change-Id: I4ed9121a48b3b2dd368ff16d5d7a268f20566609

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index f6ff83e6b..e612d9da1 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1576,7 +1576,7 @@ function onDocLayerInit() {
case 'spreadsheet':
toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'conditionalformaticonset',
'numberformatcurrency', 'numberformatpercent',
-   'numberformatincdecimals', 'numberformatdecdecimals', 
'break-number',
+   'numberformatincdecimals', 'numberformatdecdecimals', 
'break-number', 'togglemergecells', 'breakmergecells',
'setborderstyle');
toolbarUp.remove('styles');
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-02-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4f5aced8233cbbf49348b342da43f109d60b2e9a
Author: Jan Holesovsky 
AuthorDate: Mon Feb 4 19:00:07 2019 +0100
Commit: Jan Holesovsky 
CommitDate: Tue Feb 5 13:59:51 2019 +0100

conditional formatting: Enable the toolbar button in calc.

Change-Id: I7191d367f8cb95e087b8e4899e94d4d241b9fae3
Reviewed-on: https://gerrit.libreoffice.org/67375
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index aa834b88d..f6ff83e6b 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1574,7 +1574,8 @@ function onDocLayerInit() {
 
switch (docType) {
case 'spreadsheet':
-   toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'numberformatcurrency', 'numberformatpercent',
+   toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'conditionalformaticonset',
+   'numberformatcurrency', 'numberformatpercent',
'numberformatincdecimals', 'numberformatdecdecimals', 
'break-number',
'setborderstyle');
toolbarUp.remove('styles');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-02-04 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e7303d7f19393dc45896c813da262945ae18b9a8
Author: Henry Castro 
AuthorDate: Mon Feb 4 14:26:34 2019 -0400
Commit: Henry Castro 
CommitDate: Mon Feb 4 14:27:54 2019 -0400

loleaflet: remove 'Sum' from toolbar

Change-Id: I6ced414a8be20a02aee6ed3e260405715d6a6fe3

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index d6c7b755d..aa834b88d 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1575,7 +1575,7 @@ function onDocLayerInit() {
switch (docType) {
case 'spreadsheet':
toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'numberformatcurrency', 'numberformatpercent',
-   'numberformatincdecimals', 'numberformatdecdecimals', 
'sum', 'break-number',
+   'numberformatincdecimals', 'numberformatdecdecimals', 
'break-number',
'setborderstyle');
toolbarUp.remove('styles');
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-25 Thread Libreoffice Gerrit user
 loleaflet/js/jquery.mCustomScrollbar.js |3 +--
 loleaflet/src/control/Control.Scroll.js |6 +-
 loleaflet/src/layer/tile/TileLayer.js   |6 +-
 3 files changed, 3 insertions(+), 12 deletions(-)

New commits:
commit f028fd58f246d0139b35af8e7f48fed8c4a6173c
Author: Tor Lillqvist 
AuthorDate: Thu Jan 24 12:55:00 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Jan 25 12:20:01 2019 +0200

tdf#122359: Un-revert and edit in a attempt to reach a compromise

Change-Id: I0f23c70b3c4a07bae24e490eb8d1a5e56a4ba9ee

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index 442b20504..e242263e2 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -2127,8 +2127,7 @@ and dependencies (minified).
// hidden part of the document 
(for instance when pressing enter on the
// last visible line). The 
options.timeout==1 is a silly way to detect
// the mouse-wheel scrolling.
-   if((window.ThisIsAMobileApp && 
(options.drag || options.timeout===1 || 
options.calledFromInvalidateCursorMsg==true)) ||
-  (!window.ThisIsAMobileApp)) {
+   if(!window.ThisIsAMobileApp || 
options.drag || options.timeout===1 || 
options.calledFromInvalidateCursorMsg==true){
/* callbacks: 
whileScrolling */

if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
}
diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index e8df36eb8..829ce18ab 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -155,11 +155,7 @@ L.Control.Scroll = L.Control.extend({
 
_onScrollTo: function (e) {
// triggered by the document (e.g. search result out of the 
viewing area)
-   if (window.ThisIsAMobileApp) {
-   $('.scroll-container').mCustomScrollbar('scrollTo', 
[e.y, e.x], {calledFromInvalidateCursorMsg: e.calledFromInvalidateCursorMsg});
-   } else {
-   $('.scroll-container').mCustomScrollbar('scrollTo', 
[e.y, e.x]);
-   }
+   $('.scroll-container').mCustomScrollbar('scrollTo', [e.y, e.x], 
{calledFromInvalidateCursorMsg: e.calledFromInvalidateCursorMsg});
},
 
_onScrollBy: function (e) {
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index e48f0f178..7c23669ed 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1620,11 +1620,7 @@ L.TileLayer = L.GridLayer.extend({
if (!(this._selectionHandles.start && 
this._selectionHandles.start.isDragged) &&
!(this._selectionHandles.end && 
this._selectionHandles.end.isDragged) &&
!(docLayer._followEditor || docLayer._followUser)) {
-   if (window.ThisIsAMobileApp) {
-   this._map.fire('scrollto', {x: 
center.x, y: center.y, calledFromInvalidateCursorMsg: scroll !== undefined});
-   } else {
-   this._map.fire('scrollto', {x: 
center.x, y: center.y});
-   }
+   this._map.fire('scrollto', {x: center.x, y: 
center.y, calledFromInvalidateCursorMsg: scroll !== undefined});
}
}
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-23 Thread Libreoffice Gerrit user
 loleaflet/js/jquery.mCustomScrollbar.js |3 ++-
 loleaflet/src/control/Control.Scroll.js |6 +-
 loleaflet/src/layer/tile/TileLayer.js   |6 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit ec24337b11e097e98266c51d8fe56c42a8ec613a
Author: Tor Lillqvist 
AuthorDate: Wed Jan 23 17:41:53 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Jan 23 17:44:41 2019 +0200

tdf#122359: Revert e27ae38bebf4b57aa7563357a188e33d0e1e0be8 for 
non-MOBILEAPP

This will then re-introduce another issue, that the document view
jumps to the caret position when zooming, but that is a less serious
issue.

Change-Id: Iac22f4c2bc753e4311bd6c646c85937ee24b08e5

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index a0d2d325e..442b20504 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -2127,7 +2127,8 @@ and dependencies (minified).
// hidden part of the document 
(for instance when pressing enter on the
// last visible line). The 
options.timeout==1 is a silly way to detect
// the mouse-wheel scrolling.
-   if(options.drag || 
options.timeout===1 || options.calledFromInvalidateCursorMsg==true){
+   if((window.ThisIsAMobileApp && 
(options.drag || options.timeout===1 || 
options.calledFromInvalidateCursorMsg==true)) ||
+  (!window.ThisIsAMobileApp)) {
/* callbacks: 
whileScrolling */

if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
}
diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 829ce18ab..e8df36eb8 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -155,7 +155,11 @@ L.Control.Scroll = L.Control.extend({
 
_onScrollTo: function (e) {
// triggered by the document (e.g. search result out of the 
viewing area)
-   $('.scroll-container').mCustomScrollbar('scrollTo', [e.y, e.x], 
{calledFromInvalidateCursorMsg: e.calledFromInvalidateCursorMsg});
+   if (window.ThisIsAMobileApp) {
+   $('.scroll-container').mCustomScrollbar('scrollTo', 
[e.y, e.x], {calledFromInvalidateCursorMsg: e.calledFromInvalidateCursorMsg});
+   } else {
+   $('.scroll-container').mCustomScrollbar('scrollTo', 
[e.y, e.x]);
+   }
},
 
_onScrollBy: function (e) {
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 7c23669ed..e48f0f178 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1620,7 +1620,11 @@ L.TileLayer = L.GridLayer.extend({
if (!(this._selectionHandles.start && 
this._selectionHandles.start.isDragged) &&
!(this._selectionHandles.end && 
this._selectionHandles.end.isDragged) &&
!(docLayer._followEditor || docLayer._followUser)) {
-   this._map.fire('scrollto', {x: center.x, y: 
center.y, calledFromInvalidateCursorMsg: scroll !== undefined});
+   if (window.ThisIsAMobileApp) {
+   this._map.fire('scrollto', {x: 
center.x, y: center.y, calledFromInvalidateCursorMsg: scroll !== undefined});
+   } else {
+   this._map.fire('scrollto', {x: 
center.x, y: center.y});
+   }
}
}
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-08 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit 6435ef289586f8c539520a275e2f92914cce0c39
Author: Henry Castro 
AuthorDate: Tue Jan 8 16:16:41 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Jan 8 16:51:31 2019 -0400

loleaflet: simplify code to show next and prev tool items

Change-Id: Id6a3f8862b9b4539fa2c47f4c91d0f0f781b1089

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index acf248928..8909f13e5 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -851,14 +851,7 @@ function initMobileToolbar(toolItems) {
onClick(e, e.target);
hideTooltip(this, e.target);
},
-   onRefresh: function(e) {
-   var docType = map.getDocType();
-   if (docType === 'presentation' && (e.target === 'prev' 
|| e.target === 'next')) {
-   if (this.get(e.target).hidden === true) {
-   this.show(e.target);
-   }
-   }
-
+   onRefresh: function() {
var showUserList = map['wopi'].HideUserList !== null &&

map['wopi'].HideUserList !== undefined &&

$.inArray('true', map['wopi'].HideUserList) < 0 &&
@@ -1696,11 +1689,11 @@ function onDocLayerInit() {
]);
}
 
-   break;
// FALLTHROUGH intended
case 'drawing':
toolbarUp.show('leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
'breakspacing', 'defaultbullet', 'defaultnumbering', 
'breakbullet', 'inserttable');
+   statusbar.show('prev', 'next');
 
$('#presentation-toolbar').show();
break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-08 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 36e6396f62833b97e8136be83ac29508864c0438
Author: Henry Castro 
AuthorDate: Fri Jan 4 13:02:26 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Jan 8 16:23:59 2019 -0400

loleaflet: avoid fire timer event for each toolbar item

onRefresh is called for each item, so calling show will
queue timer event O(n)

Change-Id: Ice9f4d0a515f6bf56471a8eb1d07e40638a7e020

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 7517de31c..acf248928 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -851,11 +851,12 @@ function initMobileToolbar(toolItems) {
onClick(e, e.target);
hideTooltip(this, e.target);
},
-   onRefresh: function() {
+   onRefresh: function(e) {
var docType = map.getDocType();
-   if (docType === 'presentation') {
-   this.show('prev');
-   this.show('next');
+   if (docType === 'presentation' && (e.target === 'prev' 
|| e.target === 'next')) {
+   if (this.get(e.target).hidden === true) {
+   this.show(e.target);
+   }
}
 
var showUserList = map['wopi'].HideUserList !== null &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-08 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 9d8e2cf16f81b8c7ac44b6477c48220e53a7feb1
Author: Henry Castro 
AuthorDate: Fri Jan 4 11:44:32 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Jan 8 16:22:42 2019 -0400

loleaflet: add a missing break statement

Change-Id: I950de5a697d5d538ab17737e3dccf3888966c5e1

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 1c2f266f8..7517de31c 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1694,6 +1694,8 @@ function onDocLayerInit() {
{type: 'break', id: 'break8', mobile: false}
]);
}
+
+   break;
// FALLTHROUGH intended
case 'drawing':
toolbarUp.show('leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-02 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b3e4c42ab9397a57ddb2495a3de3792022a965e9
Author: Jan Holesovsky 
AuthorDate: Wed Jan 2 18:16:49 2019 +0100
Commit: Jan Holesovsky 
CommitDate: Wed Jan 2 18:24:08 2019 +0100

UI: Show the Insert Chart... toolbar button also in Writer and Impress.

Change-Id: I3178d428ddafc4c54e0223f481b8360493f94f18

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 60d17953c..ab49ed1f6 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -792,7 +792,6 @@ function createToolbar() {
{type: 'button',  id: 'numberformatpercent',  img: 
'numberformatpercent', hint: _UNO('.uno:NumberFormatPercent', 'spreadsheet', 
true), hidden: true, uno: 'NumberFormatPercent', disabled: true},
{type: 'button',  id: 'numberformatdecdecimals',  img: 
'numberformatdecdecimals', hint: _UNO('.uno:NumberFormatDecDecimals', 
'spreadsheet', true), hidden: true, uno: 'NumberFormatDecDecimals', disabled: 
true},
{type: 'button',  id: 'numberformatincdecimals',  img: 
'numberformatincdecimals', hint: _UNO('.uno:NumberFormatIncDecimals', 
'spreadsheet', true), hidden: true, uno: 'NumberFormatIncDecimals', disabled: 
true},
-   {type: 'button',  id: 'insertobjectchart',  img: 
'insertobjectchart', hint: _UNO('.uno:InsertObjectChart', '', true), hidden: 
true, uno: 'InsertObjectChart'},
{type: 'break',   id: 'break-number', hidden: true},
{type: 'button',  id: 'insertannotation', img: 'annotation', 
hint: _UNO('.uno:InsertAnnotation', '', true), hidden: true},
{type: 'drop',  id: 'inserttable',  img: 'inserttable', hint: 
_('Insert table'), hidden: true, overlay: {onShow: insertTable},
@@ -803,6 +802,7 @@ function createToolbar() {
{id: 'localgraphic', text: _('Insert Local 
Image')},
{id: 'remotegraphic', text: 
_UNO('.uno:InsertGraphic', '', true)},
]},
+   {type: 'button',  id: 'insertobjectchart',  img: 
'insertobjectchart', hint: _UNO('.uno:InsertObjectChart', '', true), uno: 
'InsertObjectChart'},
{type: 'drop',  id: 'insertshapes',  img: 
'basicshapes_ellipse', hint: _('Insert shapes'), overlay: {onShow: 
insertShapes},
html: ''},
 
@@ -1574,7 +1574,7 @@ function onDocLayerInit() {
switch (docType) {
case 'spreadsheet':
toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'numberformatcurrency', 'numberformatpercent',
-   'numberformatincdecimals', 'numberformatdecdecimals', 
'insertobjectchart', 'sum', 'break-number',
+   'numberformatincdecimals', 'numberformatdecdecimals', 
'sum', 'break-number',
'setborderstyle');
toolbarUp.remove('styles');
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-02 Thread Libreoffice Gerrit user
 loleaflet/js/w2ui-1.5.rc1.js |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 980d0fa653ca82e651357771a8c409a4554233e2
Author: Henry Castro 
AuthorDate: Mon Dec 24 12:17:07 2018 -0400
Commit: Jan Holesovsky 
CommitDate: Wed Jan 2 17:29:39 2019 +0100

loleaflet: w2toolbar: prevent default when scroll buttons is clicked

Change-Id: I1c4f7041e612c65f04f429f90dae870e0db731a5

diff --git a/loleaflet/js/w2ui-1.5.rc1.js b/loleaflet/js/w2ui-1.5.rc1.js
index 1bfb991c8..d6b0bc19c 100644
--- a/loleaflet/js/w2ui-1.5.rc1.js
+++ b/loleaflet/js/w2ui-1.5.rc1.js
@@ -13706,8 +13706,8 @@ var w2prompt = function (label, title, callBack) {
 html += ''+ this.right +'';
 html += ''+
 ''+
-''+
-'';
+''+
+'';
 $(this.box)
 .attr('name', this.name)
 .addClass('w2ui-reset w2ui-toolbar')
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-22 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit f1440cd57b279b5178764ec57440cda43ca59d77
Author: Henry Castro 
AuthorDate: Sat Dec 22 20:33:28 2018 -0400
Commit: Henry Castro 
CommitDate: Sat Dec 22 20:38:41 2018 -0400

loleaflet: force toolbar resizes when update custom ...

combo box toolbar items.

Change-Id: Ib0e6bd5b6b59ef7fb4afa32ea0e16273b72cf503

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index f20e88ec5..8de2549a6 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -2026,6 +2026,7 @@ function updateCommandValues(targetName) {
});
$('.styles-select').val(stylesSelectValue).trigger('change');
$('.styles-select').on('select2:select', onStyleSelect);
+   w2ui['editbar'].resize();
}
 
if (targetName === 'fonts' && $('.fonts-select option').length === 1) {
@@ -2048,6 +2049,7 @@ function updateCommandValues(targetName) {
});
$('.fonts-select').on('select2:select', onFontSelect);
$('.fonts-select').val(fontsSelectValue).trigger('change');
+   w2ui['editbar'].resize();
}
 
if (targetName === 'fontsizes' && $('.fontsizes-select option').length 
=== 1) {
@@ -2061,6 +2063,7 @@ function updateCommandValues(targetName) {
updateFontSizeList(fontsSelectValue);
}

$('.fontsizes-select').val(fontsizesSelectValue).trigger('change');
+   w2ui['editbar'].resize();
}
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-19 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 300b883dc04b46bbb4a692ce7145892349318d54
Author: Tor Lillqvist 
AuthorDate: Wed Dec 19 13:06:16 2018 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Dec 19 13:10:19 2018 +0200

Make the 'closemobile' button (at left, looks like '<') work in the mobile 
app

We now have two places, the handler for the 'closemobile' button and
the handler for the 'closedocument' menu entry, where we have an if
statement that checks window.ThisIsAMobileApp and if so posts the "BYE"
message to the webkit message handler in the app. Possibly we could
move that conditional code into just one place, down into the 'close'
function in L.Socket instead?

Change-Id: Ib8c6adf621945b266fa4ea5f6d66b0022c2ca373

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 82fd2eaa1..f20e88ec5 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -290,8 +290,12 @@ function onClick(e, id, item, subItem) {
L.toggleFullScreen();
}
else if (id === 'close' || id === 'closemobile') {
-   map.fire('postMessage', {msgId: 'close', args: {EverModified: 
map._everModified, Deprecated: true}});
-   map.fire('postMessage', {msgId: 'UI_Close', args: 
{EverModified: map._everModified}});
+   if (window.ThisIsAMobileApp) {
+   window.webkit.messageHandlers.lool.postMessage('BYE', 
'*');
+   } else {
+   map.fire('postMessage', {msgId: 'close', args: 
{EverModified: map._everModified, Deprecated: true}});
+   map.fire('postMessage', {msgId: 'UI_Close', args: 
{EverModified: map._everModified}});
+   }
map.remove();
}
else {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-17 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 323627a8b24dbc8d7c97b288fa63a2c73dba55d4
Author: Szymon Kłos 
AuthorDate: Mon Dec 17 13:33:06 2018 +0100
Commit: Andras Timar 
CommitDate: Mon Dec 17 17:27:30 2018 +0100

Don't show '>>' in calc's toolbar

Change-Id: I780967325655d25d1a1484c9ffbfb98b2dd5197e
Reviewed-on: https://gerrit.libreoffice.org/65279
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index c2088739b..82fd2eaa1 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1739,6 +1739,12 @@ function onDocLayerInit() {
$('#tb_editbar_item_fonts').css({'display': 'none'});
$('#tb_editbar_item_fontsizes').css({'display': 'none'});
}
+
+   if (docType == 'spreadsheet') {
+   var el = w2ui['spreadsheet-toolbar'];
+   if (el)
+   el.resize();
+   }
 }
 
 function onCommandStateChanged(e) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-15 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   35 +++
 1 file changed, 35 insertions(+)

New commits:
commit 982777ec3812395145681b36c3980ddc6d5c063d
Author: Andras Timar 
AuthorDate: Sat Dec 15 16:11:00 2018 +0100
Commit: Andras Timar 
CommitDate: Sat Dec 15 16:11:00 2018 +0100

loleaflet: two missing functions: deselectUser, onRemoveView

Change-Id: I99354e1667baba5f0f1ce10d64e597364057d46c

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 9ed53ec2a..3991ae1be 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -2336,6 +2336,15 @@ function selectUser(viewId) {
$('#tb_actionbar_item_userlist').w2overlay('');
 }
 
+function deselectUser(e) {
+   var userlistItem = w2ui['actionbar'].get('userlist');
+   if (userlistItem === null) {
+   return;
+   }
+
+   userlistItem.html = $(userlistItem.html).find('#user-' + 
e.viewId).removeClass('selected-user').parent().parent().parent()[0].outerHTML;
+}
+
 function getUserItem(viewId, userName, extraInfo, color) {
var className = 'useritem';
if (extraInfo !== undefined && extraInfo.avatar !== undefined) {
@@ -2416,6 +2425,32 @@ function onAddView(e) {
}
 }
 
+function onRemoveView(e) {
+   $('#tb_actionbar_item_userlist')
+   .w2overlay({
+   class: 'loleaflet-font',
+   html: userLeftPopupMessage.replace('%user', e.username),
+   style: 'padding: 5px'
+   });
+   clearTimeout(userPopupTimeout);
+   userPopupTimeout = setTimeout(function() {
+   $('#tb_actionbar_item_userlist').w2overlay('');
+   clearTimeout(userPopupTimeout);
+   userPopupTimeout = null;
+   }, 3000);
+
+   if (e.viewId === map._docLayer._followThis) {
+   map._docLayer._followThis = -1;
+   map._docLayer._followUser = false;
+   }
+
+   var userlistItem = w2ui['actionbar'].get('userlist');
+   if (userlistItem !== null) {
+   userlistItem.html = $(userlistItem.html).find('#user-' + 
e.viewId).remove().end()[0].outerHTML;
+   updateUserListCount();
+   }
+}
+
 $(window).resize(function() {
resizeToolbar();
 });
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-09 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js  |2 +-
 loleaflet/src/control/Signing.js |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d9dee9793bdb5b6a2bec59098eda60c1f593469f
Author: Andras Timar 
AuthorDate: Sun Dec 9 23:13:29 2018 +0100
Commit: Andras Timar 
CommitDate: Sun Dec 9 23:13:35 2018 +0100

id of Close button on Document signing bar should be unique

Change-Id: Ib4f9d044d8e943de27f36029ce54100d29553604

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 851b3c948..a25a87b0a 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1119,7 +1119,7 @@ function initNormalToolbar(toolItems) {
{type: 'spacer'},
{type: 'button',  id: 'logout',  caption: 
_('Logout'), img: '', hint: _('Logout')},
{type: 'button',  id: 'login',  caption: 
_('Login'), img: '', hint: _('Login')},
-   {type: 'button',  id: 'close', img: 
'closetoolbar', hint: _('Close')},
+   {type: 'button',  id: 
'close-document-signing-bar', img: 'closetoolbar', hint: _('Close')},
],
onClick: function (e) {
onClick(e, e.target);
diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index 68dfeb9dc..d4113cc67 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -438,7 +438,7 @@ L.Map.include({
}
},
handleSigningClickEvent: function(id, item) {
-   if (id === 'close') {
+   if (id === 'close-document-signing-bar') {
this.hideSignDocument();
}
else if (id === 'login') {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-07 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit e0e55832d0f21fa7dadaca378c551a7ec28ee90c
Author: Jan Holesovsky 
AuthorDate: Sat Dec 8 00:04:20 2018 +0100
Commit: Jan Holesovsky 
CommitDate: Sat Dec 8 00:08:17 2018 +0100

ui: Unfortunately we have to start with the 'styles' visible even in calc.

The 'hidden: true' is causing trouble, just toolbarUp.show('styles') is
not enough to make them visible ex-post, so for the moment, default to
visible.

Change-Id: If49bcaea3813ae9bcb299b8ab70750d32986a3fe

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 1c666be88..851b3c948 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -725,7 +725,7 @@ function createToolbar() {
e.item.html = undefined;
}});
}
-   }, mobile: false, hidden: true },
+   }, mobile: false },
{type: 'html',   id: 'fonts',
html: 'Liberation 
Sans',
onRefresh: function (edata) {
@@ -1574,6 +1574,8 @@ function onDocLayerInit() {
toolbarUp.show('textalign', 'wraptext', 'breakspacing', 
'insertannotation', 'numberformatcurrency', 'numberformatpercent',
'numberformatincdecimals', 'numberformatdecdecimals', 
'insertobjectchart', 'sum', 'break-number',
'setborderstyle');
+   toolbarUp.remove('styles');
+
statusbar.remove('prev', 'next', 'prevnextbreak');
 
toolbarUp.set('zoom', {
@@ -1621,7 +1623,7 @@ function onDocLayerInit() {
 
break;
case 'text':
-   toolbarUp.show('styles', 'leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
+   toolbarUp.show('leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
'breakspacing', 'defaultbullet', 'defaultnumbering', 
'breakbullet', 'incrementindent', 'decrementindent',
'breakindent', 'inserttable', 'insertannotation');
 
@@ -1667,7 +1669,7 @@ function onDocLayerInit() {
}
// FALLTHROUGH intended
case 'drawing':
-   toolbarUp.show('styles', 'leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
+   toolbarUp.show('leftpara', 'centerpara', 'rightpara', 
'justifypara', 'breakpara', 'linespacing',
'breakspacing', 'defaultbullet', 'defaultnumbering', 
'breakbullet', 'inserttable');
 
$('#presentation-toolbar').show();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-05 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 544aafe70a0e27d689b2947b6a0fc39a84d9b9fd
Author: Andras Timar 
AuthorDate: Wed Dec 5 13:09:35 2018 +0100
Commit: Andras Timar 
CommitDate: Wed Dec 5 13:09:35 2018 +0100

loleaflet: Hide spreadsheet-row-column-frame for text, presentation and 
draw documents

Change-Id: I5f47faf639dce2d972f219c31d52bfc686c112a9

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index c221a3ba4..47f13c6b8 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1471,6 +1471,7 @@ function onDocLayerInit() {
// Remove irrelevant toolbars
$('#formulabar').hide();
$('#spreadsheet-toolbar').hide();
+   $('#spreadsheet-row-column-frame').hide();
$('#presentation-toolbar').hide();
 
break;
@@ -1499,6 +1500,7 @@ function onDocLayerInit() {
// Remove irrelevant toolbars
$('#formulabar').hide();
$('#spreadsheet-toolbar').hide();
+   $('#spreadsheet-row-column-frame').hide();
 
break;
case 'drawing':
@@ -1507,6 +1509,7 @@ function onDocLayerInit() {
// Remove irrelevant toolbars
$('#formulabar').hide();
$('#spreadsheet-toolbar').hide();
+   $('#spreadsheet-row-column-frame').hide();
 
break;
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-04 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c85f1494043d370bef811a0b12ea9d41167f44f3
Author: Andras Timar 
AuthorDate: Tue Dec 4 14:30:16 2018 +0100
Commit: Andras Timar 
CommitDate: Tue Dec 4 14:30:16 2018 +0100

non-breaking space after colon in Sign toolbar

Change-Id: I91dd9642afb905d29eade9272cab257ffa0f97ad

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 33d526e62..c221a3ba4 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -947,13 +947,13 @@ function initNormalToolbar(toolItems) {
{type: 'button',  id: 'sign',  caption: 
_('Sign'), img: '', hint: _('Sign document')},
{type: 'button',  id: 'upload',  caption: 
_('Upload'), img: '', hint: _('Upload document')},
{type: 'break' },
-   {type: 'html', id: 'identity-label', html: 
'' + _('Identity:') + ' '},
+   {type: 'html', id: 'identity-label', html: 
'' + _('Identity:') + ''},
{type: 'html', id: 'identity', html: _('N/A')},
{type: 'break' },
{type: 'menu', id: 'passport', caption: 
_('Select passport'), items: []},
{type: 'html', id: 'current-passport', html: 
_('Passport: N/A')},
{type: 'break' },
-   {type: 'html', id: 
'current-document-status-label', html: '' + _('Status:') + ' '},
+   {type: 'html', id: 
'current-document-status-label', html: '' + _('Status:') + 
''},
{type: 'html', id: 'current-document-status', 
html: _('N/A')},
{type: 'spacer'},
{type: 'button',  id: 'logout',  caption: 
_('Logout'), img: '', hint: _('Logout')},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/js loleaflet/Makefile.am loleaflet/po loleaflet/src

2018-12-04 Thread Libreoffice Gerrit user
 loleaflet/Makefile.am   |1 
 loleaflet/js/toolbar.js |   18 +-
 loleaflet/po/templates/loleaflet-ui.pot |  268 +++-
 loleaflet/src/control/Signing.js|   32 +--
 4 files changed, 192 insertions(+), 127 deletions(-)

New commits:
commit 8347d2578dc70eb9b132e0b7b87275d45bc95d25
Author: Andras Timar 
AuthorDate: Tue Dec 4 11:54:20 2018 +0100
Commit: Andras Timar 
CommitDate: Tue Dec 4 11:54:20 2018 +0100

Enable l10n for most of strings in document sign feature

Change-Id: I5159051b2c42bee26e788766f29244bd2ca2f234

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 51ff68bc0..8390a275e 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -298,6 +298,7 @@ pot:
src/control/Control.Menubar.js \
src/control/Control.Scroll.Annotation.js \
src/control/Control.Tabs.js \
+   src/control/Signing.js \
src/control/Ruler.js \
src/control/Toolbar.js \
src/core/Socket.js \
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 9f5818a63..33d526e62 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -944,20 +944,20 @@ function initNormalToolbar(toolItems) {
items: [
{type: 'html',  id: 'left'},
{type: 'html', id: 'logo', html: 
'Vereign'},
-   {type: 'button',  id: 'sign',  caption: 'Sign', 
img: '', hint: _('Sign document')},
-   {type: 'button',  id: 'upload',  caption: 
'Upload', img: '', hint: _('Upload document')},
+   {type: 'button',  id: 'sign',  caption: 
_('Sign'), img: '', hint: _('Sign document')},
+   {type: 'button',  id: 'upload',  caption: 
_('Upload'), img: '', hint: _('Upload document')},
{type: 'break' },
-   {type: 'html', id: 'identity-label', html: 
'Identity:'},
-   {type: 'html', id: 'identity', html: 'N/A'},
+   {type: 'html', id: 'identity-label', html: 
'' + _('Identity:') + ' '},
+   {type: 'html', id: 'identity', html: _('N/A')},
{type: 'break' },
{type: 'menu', id: 'passport', caption: 
_('Select passport'), items: []},
-   {type: 'html', id: 'current-passport', html: 
'Passport: N/A'},
+   {type: 'html', id: 'current-passport', html: 
_('Passport: N/A')},
{type: 'break' },
-   {type: 'html', id: 
'current-document-status-label', html: 'Status:'},
-   {type: 'html', id: 'current-document-status', 
html: 'N/A'},
+   {type: 'html', id: 
'current-document-status-label', html: '' + _('Status:') + ' '},
+   {type: 'html', id: 'current-document-status', 
html: _('N/A')},
{type: 'spacer'},
-   {type: 'button',  id: 'logout',  caption: 
'Logout', img: '', hint: _('Logout')},
-   {type: 'button',  id: 'login',  caption: 
'Login', img: '', hint: _('Login')},
+   {type: 'button',  id: 'logout',  caption: 
_('Logout'), img: '', hint: _('Logout')},
+   {type: 'button',  id: 'login',  caption: 
_('Login'), img: '', hint: _('Login')},
{type: 'button',  id: 'close', img: 
'closetoolbar', hint: _('Close')},
],
onClick: function (e) {
diff --git a/loleaflet/po/templates/loleaflet-ui.pot 
b/loleaflet/po/templates/loleaflet-ui.pot
index ce1390c37..4c496454f 100644
--- a/loleaflet/po/templates/loleaflet-ui.pot
+++ b/loleaflet/po/templates/loleaflet-ui.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-11-20 18:10+0100\n"
+"POT-Creation-Date: 2018-12-04 11:51+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME \n"
 "Language-Team: LANGUAGE \n"
@@ -213,208 +213,216 @@ msgstr ""
 msgid " s"
 msgstr ""
 
-#: js/toolbar.js:153
+#: js/toolbar.js:154
 msgid "Are you sure you want to delete this page?"
 msgstr ""
 
 #: js/toolbar.js:621
-msgid "Textwrap"
-msgstr ""
-
-#: js/toolbar.js:622
-msgid "No wrap"
-msgstr ""
-
-#: js/toolbar.js:623
-msgid "Page wrap"
-msgstr ""
-
-#: js/toolbar.js:624
-msgid "Wrap anchor only"
-msgstr ""
-
-#: js/toolbar.js:625
-msgid "Ideal wrap"
-msgstr ""
-
-#: js/toolbar.js:626
-msgid "Left wrap"
-msgstr ""
-
-#: js/toolbar.js:627
-msgid "Right wrap"
-msgstr ""
-
-#: js/toolbar.js:628
-msgid "Wrap through"

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

2018-11-30 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit c57a1fbef0c846c01abc5bbbedcae81acad891c3
Author: Tor Lillqvist 
AuthorDate: Fri Nov 30 11:58:00 2018 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Nov 30 11:34:24 2018 +0100

Don't show the user indicator if there is nobody else

Especially in the mobile app it was silly to show it as there is by
definition always just one user editing a document, but it is a good
idea to simplify the UI in this case also for the web-based online.

Change-Id: I67533ffe62734dce6ca96e2a72d9ba4386fc9b74
Reviewed-on: https://gerrit.libreoffice.org/64330
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index d3fce4866..9f5818a63 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -711,7 +711,7 @@ function initMobileToolbar(toolItems) {
{type: 'button',  id: 'undo',  img: 'undo', hint: 
_UNO('.uno:Undo'), uno: 'Undo', disabled: true},
{type: 'button',  id: 'redo',  img: 'redo', hint: 
_UNO('.uno:Redo'), uno: 'Redo', disabled: true},
{type: 'button',  id: 'fullscreen', img: 'fullscreen', 
hint: _UNO('.uno:FullScreen', 'text')},
-   {type: 'drop', id: 'userlist', img: 'users', html: 
'' +
+   {type: 'drop', id: 'userlist', img: 'users', hidden: 
true, html: '' +
'' +
'' +
'' +
@@ -1034,7 +1034,7 @@ function initNormalToolbar(toolItems) {
{type: 'html',  id: 'right'},
{type: 'html',id: 'modifiedstatuslabel', 
html: '', 
mobile:false},
{type: 'break', id: 'modifiedstatuslabelbreak', 
mobile:false},
-   {type: 'drop', id: 'userlist', text: _('No 
users'), html: '' +
+   {type: 'drop', id: 'userlist', hidden: true, 
text: _('No users'), html: '' +
'' +
'' +
'' +
@@ -2131,6 +2131,12 @@ function updateUserListCount() {
var zoomlevel = $('#zoomlevel').html();
w2ui['toolbar-down'].refresh();
$('#zoomlevel').html(zoomlevel);
+
+   if (count > 1) {
+   $('#tb_toolbar-down_item_userlist').show();
+   } else {
+   $('#tb_toolbar-down_item_userlist').hide();
+   }
 }
 
 function onAddView(e) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-28 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   14 --
 1 file changed, 14 deletions(-)

New commits:
commit 5eaaeb5bb2654af99aeca15e3303aed9226cd91a
Author: Thorsten Behrens 
AuthorDate: Wed Nov 28 17:28:36 2018 +0100
Commit: Andras Timar 
CommitDate: Wed Nov 28 21:20:33 2018 +0100

loleaflet: remove TextWrap menu from toolbar

Since it's available already from the context menu.

Change-Id: Ia79a5f21b2d757621a3cb8d7114b90617c6c2acf
Reviewed-on: https://gerrit.libreoffice.org/64181
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 2fac097ff..eb4be1346 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -173,11 +173,6 @@ function onClick(e, id, item, subItem) {
else if (id === 'lastrecord') {

$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').scrollLeft()
 + 120);
}
-   else if (id.startsWith('menu-wrap:wrap-'))
-   {
-   var wrapType = id.substring('menu-wrap:wrap-'.length);
-   map.toggleCommandState(wrapType);
-   }
else if (id === 'insertgraphic' || item.id === 'localgraphic') {
L.DomUtil.get('insertgraphic').click();
}
@@ -622,15 +617,6 @@ var fontsizesSelectValue;
 
 function createToolbar() {
var toolItems = [
-   {type: 'menu', id: 'menu-wrap', caption: _('Textwrap'), mobile: 
false, items: [
-   { text: _('No wrap'), id: 'wrap-WrapOff' },
-   { text: _('Page wrap'), id: 'wrap-WrapOn' },
-   { text: _('Wrap anchor only'), id: 
'wrap-WrapAnchorOnly' },
-   { text: _('Ideal wrap'), id: 'wrap-WrapIdeal' },
-   { text: _('Left wrap'), id: 'wrap-WrapLeft' },
-   { text: _('Right wrap'), id: 'wrap-WrapRight' },
-   { text: _('Wrap through'), id: 'wrap-WrapThrough' }
-   ]},
{type: 'button',  id: 'save', img: 'save', hint: 
_UNO('.uno:Save')},
{type: 'break', id: 'savebreak'},
{type: 'button',  id: 'undo',  img: 'undo', hint: 
_UNO('.uno:Undo'), uno: 'Undo', disabled: true, mobile: false},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-27 Thread Libreoffice Gerrit user
 loleaflet/js/toolbar.js |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 192677b34f8ce92aa8bd3bf62c7da42764ee2b0a
Author: Tor Lillqvist 
AuthorDate: Tue Nov 27 18:39:38 2018 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Nov 27 18:48:59 2018 +0200

Don't hide the font and font size widgets in a mobile app

Once the Format>Character... dialog works better in a mobile app we
might revert this. But for now the font selection feature in that
dialog is sadly practically unusable.

Change-Id: I60ae6469a588b50b5e2acb5a6a04a04271b1ca47

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 0b293580b..2fac097ff 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -26,7 +26,8 @@ function _mobilify() {
var statusbar = w2ui['toolbar-down'];
 
toolbarUp.items.forEach(function(item) {
-   if (item.mobile === false && !item.hidden) {
+   if ((item.mobile === false ||
+(!window.ThisIsAMobileApp && item.mobilebrowser === 
false)) && !item.hidden) {
toolbarUp.hide(item.id);
}
});
@@ -616,6 +617,9 @@ var stylesSelectValue;
 var fontsSelectValue;
 var fontsizesSelectValue;
 
+// mobile:false means hide it both for normal Online used from a mobile 
browser, and in a mobile app
+// mobilebrowser:false means hide it for normal Online used from a mobile 
browser, but don't hide it in a mobile app
+
 function createToolbar() {
var toolItems = [
{type: 'menu', id: 'menu-wrap', caption: _('Textwrap'), mobile: 
false, items: [
@@ -634,8 +638,8 @@ function createToolbar() {
{type: 'button',  id: 'repair', img: 'repair', hint: 
_('Document repair'), disabled: true, mobile: false},
{type: 'break', mobile: false},
{type: 'html',   id: 'styles', html: '', mobile: false},
-   {type: 'html',   id: 'fonts', html: '', mobile: false},
-   {type: 'html',   id: 'fontsizes', html: '', mobile: false},
+   {type: 'html',   id: 'fonts', html: '', mobilebrowser: false},
+   {type: 'html',   id: 'fontsizes', html: '', mobilebrowser: false},
{type: 'break', mobile: false},
{type: 'button',  id: 'bold',  img: 'bold', hint: 
_UNO('.uno:Bold'), uno: 'Bold', disabled: true},
{type: 'button',  id: 'italic', img: 'italic', hint: 
_UNO('.uno:Italic'), uno: 'Italic', disabled: true},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >