[PE embedded][SSE embedded] Show loader mask

This commit is contained in:
Julia Radzhabova 2021-06-25 00:48:20 +03:00
parent 8766f4db61
commit 2edcfb779b
13 changed files with 38 additions and 72 deletions

View file

@ -66,6 +66,7 @@ common.view.LoadMask = function(owner) {
// show mask after 500 ms if it wont be hided
if (!rendered) {
rendered = true;
timerId = setTimeout(function () {
ownerEl.append(maskedEl);
ownerEl.append(loaderEl);
@ -83,6 +84,7 @@ common.view.LoadMask = function(owner) {
maskedEl && maskedEl.remove();
loaderEl && loaderEl.remove();
maskedEl = loaderEl = null;
rendered = false;
},
setTitle: function(text) {

View file

@ -273,11 +273,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->
@ -307,6 +302,7 @@
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/LoadMask.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
<script type="text/javascript" src="js/ApplicationView.js"></script>

View file

@ -267,11 +267,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->

View file

@ -322,11 +322,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->
@ -349,6 +344,7 @@
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/LoadMask.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
<script type="text/javascript" src="js/ApplicationView.js"></script>

View file

@ -315,11 +315,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->

View file

@ -43,6 +43,8 @@ PE.ApplicationController = new(function(){
ttOffset = [0, -10],
labelDocName;
var LoadingDocument = -256;
// Initialize analytics
// -------------------------
@ -156,19 +158,24 @@ PE.ApplicationController = new(function(){
case Asc.c_oAscAsyncAction['Print']:
text = me.downloadTextText;
break;
case LoadingDocument:
text = me.textLoadingDocument + ' ';
break;
default:
text = me.waitText;
break;
}
if (type == Asc.c_oAscAsyncActionType['BlockInteraction']) {
$('#id-loadmask .cmd-loader-title').html(text);
showMask();
if (!me.loadMask)
me.loadMask = new common.view.LoadMask();
me.loadMask.setTitle(text);
me.loadMask.show();
}
}
function onLongActionEnd(){
hideMask();
me.loadMask && me.loadMask.hide();
}
function onDocMouseMoveStart() {
@ -244,6 +251,7 @@ PE.ApplicationController = new(function(){
onPlayStart();
}
hidePreloader();
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
var zf = (config.customization && config.customization.zoom ? parseInt(config.customization.zoom) : -1);
(zf == -1) ? api.zoomFitToPage() : ((zf == -2) ? api.zoomFitToWidth() : api.zoom(zf>0 ? zf : 100));
@ -469,6 +477,7 @@ PE.ApplicationController = new(function(){
else
$parent.css('padding-right', _left_width - _right_width);
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(true);
api.asc_LoadDocument();
api.Resize();
@ -476,7 +485,7 @@ PE.ApplicationController = new(function(){
function onOpenDocument(progress) {
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
$('#loadmask-text').html(me.textLoadingDocument + ': ' + Math.min(Math.round(proc * 100), 100) + '%');
me.loadMask && me.loadMask.setTitle(me.textLoadingDocument + ': ' + common.utils.fixedDigits(Math.min(Math.round(proc*100), 100), 3, " ") + '%');
}
var isplaymode;
@ -505,17 +514,6 @@ PE.ApplicationController = new(function(){
$('#page-number').val(number);
}
function showMask() {
$('#id-loadmask').modal({
backdrop: 'static',
keyboard: false
});
}
function hideMask() {
$('#id-loadmask').modal('hide');
}
function onError(id, level, errData) {
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
$('#id-critical-error-title').text(me.criticalErrorTitle);
@ -528,7 +526,8 @@ PE.ApplicationController = new(function(){
}
hidePreloader();
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
var message;
switch (id)

View file

@ -246,11 +246,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->
@ -283,6 +278,7 @@
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/LoadMask.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
<script type="text/javascript" src="js/ApplicationView.js"></script>

View file

@ -238,11 +238,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->

View file

@ -321,11 +321,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->
@ -351,6 +346,7 @@
<script type="text/javascript" src="../../common/Analytics.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/LocalStorage.js"></script>
<script type="text/javascript" src="../../common/embed/lib/util/utils.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/LoadMask.js"></script>
<script type="text/javascript" src="../../common/embed/lib/view/modals.js"></script>
<script type="text/javascript" src="../../common/embed/lib/controller/modals.js"></script>
<script type="text/javascript" src="js/ApplicationView.js"></script>

View file

@ -313,11 +313,6 @@
</div>
</div>
<div id="id-loadmask" class="hide modal cmd-loader-body">
<div class="cmd-loader-image"></div>
<div class="cmd-loader-title">Please wait...</div>
</div>
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
<!--vendor-->

View file

@ -45,6 +45,8 @@ SSE.ApplicationController = new(function(){
ttOffset = [6, -15],
labelDocName;
var LoadingDocument = -256;
// Initialize analytics
// -------------------------
@ -196,6 +198,7 @@ SSE.ApplicationController = new(function(){
function onDocumentContentReady() {
hidePreloader();
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
if ( permissions.print === false)
$('#idt-print').hide();
@ -230,6 +233,7 @@ SSE.ApplicationController = new(function(){
api.asc_registerCallback('asc_onDownloadUrl', onDownloadUrl);
api.asc_registerCallback('asc_onPrint', onPrint);
api.asc_registerCallback('asc_onPrintUrl', onPrintUrl);
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
Common.Gateway.on('processmouse', onProcessMouse);
Common.Gateway.on('downloadas', onDownloadAs);
@ -371,24 +375,14 @@ SSE.ApplicationController = new(function(){
else
$parent.css('padding-right', _left_width - _right_width);
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(true);
api.asc_LoadDocument();
}
function showMask() {
$('#id-loadmask').modal({
backdrop: 'static',
keyboard: false
});
}
function hideMask() {
$('#id-loadmask').modal('hide');
}
function onOpenDocument(progress) {
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
$('#loadmask-text').html(me.textLoadingDocument + ': ' + Math.min(Math.round(proc * 100), 100) + '%');
me.loadMask && me.loadMask.setTitle(me.textLoadingDocument + ': ' + common.utils.fixedDigits(Math.min(Math.round(proc*100), 100), 3, " ") + '%');
}
function onLongActionBegin(type, id){
@ -398,14 +392,19 @@ SSE.ApplicationController = new(function(){
case Asc.c_oAscAsyncAction['Print']:
text = me.downloadTextText;
break;
case LoadingDocument:
text = me.textLoadingDocument + ' ';
break;
default:
text = me.waitText;
break;
}
if (type == Asc.c_oAscAsyncActionType['BlockInteraction']) {
$('#id-loadmask .cmd-loader-title').html(text);
showMask();
if (!me.loadMask)
me.loadMask = new common.view.LoadMask();
me.loadMask.setTitle(text);
me.loadMask.show();
}
}
@ -424,7 +423,7 @@ SSE.ApplicationController = new(function(){
break;
}
hideMask();
me.loadMask && me.loadMask.hide();
}
}
@ -440,6 +439,7 @@ SSE.ApplicationController = new(function(){
}
hidePreloader();
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
var message;
@ -625,7 +625,6 @@ SSE.ApplicationController = new(function(){
});
if (api){
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
api.asc_registerCallback('asc_onError', onError);
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);

View file

@ -416,6 +416,7 @@
"../apps/common/Analytics.js",
"../apps/common/embed/lib/util/LocalStorage.js",
"../apps/common/embed/lib/util/utils.js",
"../apps/common/embed/lib/view/LoadMask.js",
"../apps/common/embed/lib/view/modals.js",
"../apps/common/embed/lib/controller/modals.js",
"../apps/presentationeditor/embed/js/ApplicationView.js",

View file

@ -429,6 +429,7 @@
"../apps/common/Analytics.js",
"../apps/common/embed/lib/util/LocalStorage.js",
"../apps/common/embed/lib/util/utils.js",
"../apps/common/embed/lib/view/LoadMask.js",
"../apps/common/embed/lib/view/modals.js",
"../apps/common/embed/lib/controller/modals.js",
"../apps/spreadsheeteditor/embed/js/ApplicationView.js",