Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-07-10 19:02:50 +0300
committerGitHub <noreply@github.com>2019-07-10 19:02:50 +0300
commit7ef88922deb5cc8e5ecb57e7a6eda56d127e14f6 (patch)
treeba25f19c037f576e6375c79d147c0997eeb2091a
parentf34e1c5d3a85f431da29f1ce3cd99ebc27d066c1 (diff)
parent842d5f2ef665edabaed581701a849736adcfde5c (diff)
Merge pull request #542 from nextcloud/enh/loading-speed
Loading time improvements
-rw-r--r--css/style.css5
-rw-r--r--css/viewer.scss1
-rw-r--r--js/documents.js11
-rw-r--r--js/viewer/viewer.js27
4 files changed, 21 insertions, 23 deletions
diff --git a/css/style.css b/css/style.css
index ffbd53af..83f39867 100644
--- a/css/style.css
+++ b/css/style.css
@@ -25,10 +25,6 @@ body {
vertical-align: top;
}
-.documentslist .progress{
- border: 1px solid #e8e8e8;
-}
-
.documentslist .progress div{
margin-top: 144px;
text-align: center;
@@ -52,7 +48,6 @@ body {
width: 200px;
background-repeat: no-repeat;
background-size: 200px;
- border: 1px solid #e8e8e8;
}
.document a:hover {
border: 1px solid #818181;
diff --git a/css/viewer.scss b/css/viewer.scss
index a6e9f68e..18ce7fc4 100644
--- a/css/viewer.scss
+++ b/css/viewer.scss
@@ -37,7 +37,6 @@
#richdocumentsframe {
background-color: #fff;
width:100%;
- /** TODO: This will probably look odd on 13 */
height: calc(100vh - 50px);
display:block;
position:absolute;
diff --git a/js/documents.js b/js/documents.js
index 896ba350..5dffc629 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -567,7 +567,7 @@ var documentsMain = {
}
if (!documentsMain.renderComplete) {
- setTimeout(function() { documentsMain.UI.showEditor(title, action); }, 500);
+ setTimeout(function() { documentsMain.UI.showEditor(title, action); }, 10);
console.log('Waiting for page to render…');
return;
}
@@ -580,9 +580,6 @@ var documentsMain = {
$(document.body).addClass("claro");
$(document.body).prepend(documentsMain.UI.container);
- documentsMain.documentTitle = title;
- parent.document.title = documentsMain.documentTitle + ' - ' + documentsMain.UI.mainTitle;
-
// WOPISrc - URL that loolwsd will access (ie. pointing to ownCloud)
var wopiurl = window.location.protocol + '//' + window.location.host + OC.getRootPath() + '/index.php/apps/richdocuments/wopi/files/' + documentsMain.fileId;
var wopisrc = encodeURIComponent(wopiurl);
@@ -926,10 +923,6 @@ var documentsMain = {
}
documentsMain.ready = true;
- if (parent && documentsMain.getFileList() !== null && typeof documentsMain.getFileList() !== 'undefined') {
- documentsMain.getFileList().reload();
- parent.document.title = documentsMain.documentTitle + ' - ' + documentsMain.UI.mainTitle;
- }
},
WOPIPostMessage: function(iframe, msgId, values) {
@@ -1081,7 +1074,6 @@ var documentsMain = {
},
show: function(fileId){
- documentsMain.UI.showProgress(t('richdocuments', 'Loading documents…'));
documentsMain.docs.documentGrid('render', fileId);
documentsMain.UI.hideProgress();
},
@@ -1112,6 +1104,7 @@ $(document).ready(function() {
documentsMain.docs = $('.documentslist').documentGrid();
documentsMain.overlay = $('<div id="documents-overlay" class="icon-loading"></div><div id="documents-overlay-below" class="icon-loading-dark"></div>').documentOverlay();
+ documentsMain.overlay.hide();
$('li.document a').tooltip({fade: true, live: true});
diff --git a/js/viewer/viewer.js b/js/viewer/viewer.js
index f7ebdd8a..15db0782 100644
--- a/js/viewer/viewer.js
+++ b/js/viewer/viewer.js
@@ -20,6 +20,7 @@ var Preload = {
var odfViewer = {
isDocuments : false,
nextcloudVersion: 0,
+ receivedLoading: false,
supportedMimes: OC.getCapabilities().richdocuments.mimetypes.concat(OC.getCapabilities().richdocuments.mimetypesNoDefaultOpen),
excludeMimeFromDefaultOpen: OC.getCapabilities().richdocuments.mimetypesNoDefaultOpen,
register : function() {
@@ -65,6 +66,7 @@ var odfViewer = {
var fileId = context.fileId || context.$file.attr('data-id');
var templateId = context.templateId;
}
+ odfViewer.receivedLoading = false;
var viewer;
if($('#isPublic').val() === '1') {
@@ -95,17 +97,21 @@ var odfViewer = {
if(context) {
FileList.setViewerMode(true);
+ FileList.setPageTitle(fileName);
+ FileList.showMask();
}
OC.addStyle('richdocuments', 'mobile');
var $iframe = $('<iframe id="richdocumentsframe" nonce="' + btoa(OC.requestToken) + '" scrolling="no" allowfullscreen src="'+viewer+'" />');
- $.get(OC.generateUrl('/apps/richdocuments/settings/check'), function() {
- $iframe.src = viewer;
- }) .fail(function() {
- odfViewer.onClose();
- OC.Notification.showTemporary(t('richdocuments', 'Failed to load {productName} - please try again later', {productName: OC.getCapabilities().richdocuments.productName || 'Collabora Online'}));
- });
+ odfViewer.loadingTimeout = setTimeout(function() {
+ if (!odfViewer.receivedLoading) {
+ odfViewer.onClose();
+ OC.Notification.showTemporary(t('richdocuments', 'Failed to load {productName} - please try again later', {productName: OC.getCapabilities().richdocuments.productName || 'Collabora Online'}));
+ }
+ }, 15000);
+ $iframe.src = viewer;
+
$('body').css('overscroll-behavior-y', 'none');
var viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no');
@@ -123,6 +129,7 @@ var odfViewer = {
} else {
$('body').css('overflow', 'hidden');
$('#app-content').append($iframe);
+ $iframe.hide();
if ($('header').length) {
var $button = $('<div class="richdocuments-sharing"><a class="icon-shared icon-white"></a></div>');
$('.header-right').prepend($button);
@@ -136,7 +143,6 @@ var odfViewer = {
OC.Apps.showAppSidebar();
});
$('.searchbox').hide();
- $('#app-navigation').addClass('hidden');
}
}
@@ -144,14 +150,16 @@ var odfViewer = {
},
onClose: function() {
+ clearTimeout(odfViewer.loadingTimeout)
if(typeof FileList !== "undefined") {
FileList.setViewerMode(false);
FileList.reload();
+ FileList.setPageTitle();
}
+ odfViewer.receivedLoading = false;
$('link[href*="richdocuments/css/mobile"]').remove();
$('#app-content #controls').removeClass('hidden');
$('#richdocumentsframe').remove();
- $('#app-navigation').removeClass('hidden');
$('.richdocuments-sharing').remove();
$('#richdocuments-avatars').remove();
$('#richdocuments-actions').remove();
@@ -397,7 +405,10 @@ $(document).ready(function() {
if (e.data === 'close') {
odfViewer.onClose();
} else if(e.data === 'loading') {
+ odfViewer.receivedLoading = true;
+ $('#richdocumentsframe').show();
$('#content').removeClass('loading');
+ FileList.hideMask();
}
}, false);
});