cleaning
This commit is contained in:
parent
4fbedc3b7b
commit
028b9e5ed7
|
@ -11,8 +11,6 @@
|
||||||
<link rel="stylesheet/less" type="text/css" href="resources/less/application.less" />
|
<link rel="stylesheet/less" type="text/css" href="resources/less/application.less" />
|
||||||
<!-- debug end -->
|
<!-- debug end -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script
|
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
@ -65,9 +63,9 @@
|
||||||
|
|
||||||
var params = getUrlParams(),
|
var params = getUrlParams(),
|
||||||
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
|
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
|
||||||
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
|
//logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
|
||||||
|
|
||||||
window.frameEditorId = params["frameEditorId"];
|
/*window.frameEditorId = params["frameEditorId"];
|
||||||
window.parentOrigin = params["parentOrigin"];
|
window.parentOrigin = params["parentOrigin"];
|
||||||
|
|
||||||
var elem = document.querySelector('.loading-logo');
|
var elem = document.querySelector('.loading-logo');
|
||||||
|
@ -76,7 +74,7 @@
|
||||||
var img = document.querySelector('.loading-logo img');
|
var img = document.querySelector('.loading-logo img');
|
||||||
img && img.setAttribute('src', logo);
|
img && img.setAttribute('src', logo);
|
||||||
img.style.opacity = 1;
|
img.style.opacity = 1;
|
||||||
}
|
}*/
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="editor_sdk" class="viewer top" style="overflow: hidden;" tabindex="-1"></div>
|
<div id="editor_sdk" class="viewer top" style="overflow: hidden;" tabindex="-1"></div>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<body class="embed-body">
|
<body class="embed-body">
|
||||||
<div id="loading-mask" class="loadmask">
|
<div id="loading-mask" class="loadmask">
|
||||||
<div class="brendpanel">
|
<!--<div class="brendpanel">
|
||||||
<div>
|
<div>
|
||||||
<div class="brand-logo loading-logo">
|
<div class="brand-logo loading-logo">
|
||||||
<img src="">
|
<img src="">
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
<!-- debug begin -->
|
<!-- debug begin -->
|
||||||
<script type="text/javascript">var less=less||{};less.env='development';</script>
|
<script type="text/javascript">var less=less||{};less.env='development';</script>
|
||||||
|
@ -97,23 +97,23 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="box-preview">
|
<!--<div id="box-preview">
|
||||||
<div id="id-preview" tabindex="-1"></div>
|
<div id="id-preview" tabindex="-1"></div>
|
||||||
</div>
|
</div>-->
|
||||||
<div id="editor_sdk" class="viewer top" style="overflow: hidden;" tabindex="-1"></div>
|
<div id="editor_sdk" class="viewer top" style="overflow: hidden;" tabindex="-1"></div>
|
||||||
|
|
||||||
<div class="overlay-controls" style="margin-left: -32px">
|
<!--<div class="overlay-controls" style="margin-left: -32px">
|
||||||
<ul class="left">
|
<ul class="left">
|
||||||
<li id="btn-left"><button class="overlay svg-icon slide-prev"></button></li>
|
<li id="btn-left"><button class="overlay svg-icon slide-prev"></button></li>
|
||||||
<li id="btn-play"><button class="overlay svg-icon play"></button></li>
|
<li id="btn-play"><button class="overlay svg-icon play"></button></li>
|
||||||
<li id="btn-right"><button class="overlay svg-icon slide-next"></button></li>
|
<li id="btn-right"><button class="overlay svg-icon slide-next"></button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<div class="toolbar" id="toolbar">
|
<!--<div class="toolbar" id="toolbar">
|
||||||
<div class="group left">
|
<div class="group left">
|
||||||
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
|
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
|
||||||
</div>
|
</div>-
|
||||||
<div class="group center">
|
<div class="group center">
|
||||||
<span id="title-doc-name"></span>
|
<span id="title-doc-name"></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -123,9 +123,9 @@
|
||||||
<button class="control-btn svg-icon more-vertical"></button>
|
<button class="control-btn svg-icon more-vertical"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
<div class="error modal fade" id="id-critical-error-dialog" tabindex="-1" role="dialog">
|
<!--<div class="error modal fade" id="id-critical-error-dialog" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>
|
<div class="hyperlink-tooltip" data-toggle="tooltip" title="Press Ctrl and click the link" style="display:none;"></div>-->
|
||||||
|
|
||||||
<!--vendor-->
|
<!--vendor-->
|
||||||
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
|
||||||
|
|
|
@ -136,20 +136,12 @@ PE.ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
embedConfig.docTitle = docConfig.title;
|
embedConfig.docTitle = docConfig.title;
|
||||||
labelDocName = $('#title-doc-name');
|
//labelDocName = $('#title-doc-name');
|
||||||
labelDocName.text(embedConfig.docTitle || '')
|
//labelDocName.text(embedConfig.docTitle || '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCountPages(count) {
|
|
||||||
maxPages = count;
|
|
||||||
$('#pages').text(me.textOf + " " + count);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onCurrentPage(number) {
|
|
||||||
$('#page-number').val(number + 1);
|
|
||||||
currentPage = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onLongActionBegin(type, id) {
|
function onLongActionBegin(type, id) {
|
||||||
var text = '';
|
var text = '';
|
||||||
|
@ -178,60 +170,13 @@ PE.ApplicationController = new(function(){
|
||||||
me.loadMask && me.loadMask.hide();
|
me.loadMask && me.loadMask.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDocMouseMoveStart() {
|
|
||||||
me.isHideBodyTip = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var $ttEl, $tooltip;
|
|
||||||
function onDocMouseMoveEnd() {
|
|
||||||
if (me.isHideBodyTip) {
|
|
||||||
if ( $tooltip ) {
|
|
||||||
$tooltip.tooltip('hide');
|
|
||||||
$tooltip = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDocMouseMove(data) {
|
|
||||||
if (data) {
|
|
||||||
if (data.get_Type() == 1) { // hyperlink
|
|
||||||
me.isHideBodyTip = false;
|
|
||||||
|
|
||||||
if ( !$ttEl ) {
|
|
||||||
$ttEl = $('.hyperlink-tooltip');
|
|
||||||
$ttEl.tooltip({'container':'body', 'trigger':'manual'});
|
|
||||||
$ttEl.on('shown.bs.tooltip', function(e) {
|
|
||||||
$tooltip = $ttEl.data('bs.tooltip').tip();
|
|
||||||
|
|
||||||
$tooltip.css({
|
|
||||||
left: $ttEl.ttpos[0] + ttOffset[0],
|
|
||||||
top: $ttEl.ttpos[1] + ttOffset[1]
|
|
||||||
});
|
|
||||||
|
|
||||||
$tooltip.find('.tooltip-arrow').css({left: 10});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !$tooltip ) {
|
|
||||||
$ttEl.ttpos = [data.get_X(), data.get_Y()];
|
|
||||||
$ttEl.tooltip('show');
|
|
||||||
} else {
|
|
||||||
$tooltip.css({
|
|
||||||
left:data.get_X() + ttOffset[0],
|
|
||||||
top:data.get_Y() + ttOffset[1]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDownloadUrl(url, fileType) {
|
function onDownloadUrl(url, fileType) {
|
||||||
Common.Gateway.downloadAs(url, fileType);
|
Common.Gateway.downloadAs(url, fileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPrint() {
|
function onPrint() {
|
||||||
if (permissions.print!==false)
|
if (permissions.print!==false)
|
||||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
|
api.asc_Print(new Asc.asc_CDownloadOptions(null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPrintUrl(url) {
|
function onPrintUrl(url) {
|
||||||
|
@ -244,49 +189,12 @@ PE.ApplicationController = new(function(){
|
||||||
|
|
||||||
function onDocumentContentReady() {
|
function onDocumentContentReady() {
|
||||||
api.ShowThumbnails(true);
|
api.ShowThumbnails(true);
|
||||||
//api.asc_DeleteVerticalScroll();
|
|
||||||
|
|
||||||
/*if (!embedConfig.autostart || embedConfig.autostart == 'player') {
|
|
||||||
api.SetDemonstrationModeOnly();
|
|
||||||
onPlayStart();
|
|
||||||
}*/
|
|
||||||
hidePreloader();
|
hidePreloader();
|
||||||
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
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));
|
|
||||||
|
|
||||||
if ( permissions.print === false)
|
|
||||||
$('#idt-print').hide();
|
|
||||||
|
|
||||||
if (!embedConfig.saveUrl && permissions.print === false)
|
|
||||||
$('#idt-download').hide();
|
|
||||||
|
|
||||||
if ( !embedConfig.shareUrl )
|
|
||||||
$('#idt-share').hide();
|
|
||||||
|
|
||||||
if (!config.canBackToFolder)
|
|
||||||
$('#idt-close').hide();
|
|
||||||
|
|
||||||
if ( !embedConfig.embedUrl )
|
|
||||||
$('#idt-embed').hide();
|
|
||||||
|
|
||||||
if ( !embedConfig.fullscreenUrl )
|
|
||||||
$('#idt-fullscreen').hide();
|
|
||||||
|
|
||||||
if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder)
|
|
||||||
$('#box-tools').addClass('hidden');
|
|
||||||
else if (!embedConfig.embedUrl && !embedConfig.fullscreenUrl)
|
|
||||||
$('#box-tools .divider').hide();
|
|
||||||
|
|
||||||
/*common.controller.modals.attach({
|
|
||||||
share: '#idt-share',
|
|
||||||
embed: '#idt-embed'
|
|
||||||
});*/
|
|
||||||
|
|
||||||
api.asc_registerCallback('asc_onMouseMoveStart', onDocMouseMoveStart);
|
|
||||||
api.asc_registerCallback('asc_onMouseMoveEnd', onDocMouseMoveEnd);
|
|
||||||
api.asc_registerCallback('asc_onMouseMove', onDocMouseMove);
|
|
||||||
|
|
||||||
api.asc_registerCallback('asc_onDownloadUrl', onDownloadUrl);
|
api.asc_registerCallback('asc_onDownloadUrl', onDownloadUrl);
|
||||||
api.asc_registerCallback('asc_onPrint', onPrint);
|
api.asc_registerCallback('asc_onPrint', onPrint);
|
||||||
|
@ -295,187 +203,29 @@ PE.ApplicationController = new(function(){
|
||||||
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
||||||
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
||||||
|
|
||||||
api.asc_registerCallback('asc_onEndDemonstration', onPlayStop);
|
// api.asc_registerCallback('asc_onEndDemonstration', onPlayStop);
|
||||||
api.asc_registerCallback('asc_onDemonstrationSlideChanged', onPlaySlideChanged);
|
//.asc_registerCallback('asc_onDemonstrationSlideChanged', onPlaySlideChanged);
|
||||||
|
|
||||||
Common.Gateway.on('processmouse', onProcessMouse);
|
Common.Gateway.on('processmouse', onProcessMouse);
|
||||||
Common.Gateway.on('downloadas', onDownloadAs);
|
Common.Gateway.on('downloadas', onDownloadAs);
|
||||||
Common.Gateway.on('requestclose', onRequestClose);
|
Common.Gateway.on('requestclose', onRequestClose);
|
||||||
|
|
||||||
PE.ApplicationView.tools.get('#idt-fullscreen')
|
|
||||||
.on('click', function(){
|
|
||||||
common.utils.openLink(embedConfig.fullscreenUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
PE.ApplicationView.tools.get('#idt-download')
|
|
||||||
.on('click', function(){
|
|
||||||
if ( !!embedConfig.saveUrl ){
|
|
||||||
common.utils.openLink(embedConfig.saveUrl);
|
|
||||||
} else
|
|
||||||
if (api && permissions.print!==false){
|
|
||||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Common.Analytics.trackEvent('Save');
|
|
||||||
});
|
|
||||||
|
|
||||||
PE.ApplicationView.tools.get('#idt-print')
|
|
||||||
.on('click', function(){
|
|
||||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
|
|
||||||
//Common.Analytics.trackEvent('Print');
|
|
||||||
});
|
|
||||||
|
|
||||||
PE.ApplicationView.tools.get('#idt-close')
|
|
||||||
.on('click', function(){
|
|
||||||
if (config.customization && config.customization.goback) {
|
|
||||||
if (config.customization.goback.requestClose && config.canRequestClose)
|
|
||||||
Common.Gateway.requestClose();
|
|
||||||
else if (config.customization.goback.url)
|
|
||||||
window.parent.location.href = config.customization.goback.url;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var $pagenum = $('#page-number');
|
|
||||||
$pagenum.on({
|
|
||||||
'keyup': function(e){
|
|
||||||
if ( e.keyCode == 13 ){
|
|
||||||
var newPage = parseInt($('#page-number').val());
|
|
||||||
|
|
||||||
if ( isNaN(newPage) ) {
|
|
||||||
$('#page-number').val(currentPage + 1);
|
|
||||||
} else {
|
|
||||||
if ( newPage > maxPages ) newPage = maxPages; else
|
|
||||||
if ( newPage < 2 ) newPage = 1;
|
|
||||||
|
|
||||||
if ( newPage == currentPage + 1 ) {
|
|
||||||
$('#page-number').val( newPage );
|
|
||||||
} else
|
|
||||||
if (isplaymode) {
|
|
||||||
currentPage = newPage - 1;
|
|
||||||
api.DemonstrationGoToSlide(newPage - 1);
|
|
||||||
} else api.goToPage(newPage - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pagenum.blur();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, 'focusin' : function(e) {
|
|
||||||
$pagenum.removeClass('masked');
|
|
||||||
}
|
|
||||||
, 'focusout': function(e){
|
|
||||||
!$pagenum.hasClass('masked') && $pagenum.addClass('masked');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#pages').on('click', function(e) {
|
|
||||||
$pagenum.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn-left').on('click', function(){
|
|
||||||
if ( isplaymode ) {
|
|
||||||
api.DemonstrationPrevSlide();
|
|
||||||
} else
|
|
||||||
if (currentPage > 0) {
|
|
||||||
api.goToPage(currentPage - 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn-right').on('click', function(){
|
|
||||||
if ( isplaymode ) {
|
|
||||||
api.DemonstrationNextSlide();
|
|
||||||
} else
|
|
||||||
if (currentPage < maxPages - 1) {
|
|
||||||
api.goToPage(currentPage + 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var documentMoveTimer;
|
|
||||||
var ismoved = false;
|
|
||||||
$(document).on({
|
|
||||||
'click': function(e) {
|
|
||||||
clearTimeout(documentMoveTimer);
|
|
||||||
documentMoveTimer = undefined;
|
|
||||||
},
|
|
||||||
'mousemove': function (e) {
|
|
||||||
$('#btn-left').fadeIn();
|
|
||||||
$('#btn-right').fadeIn();
|
|
||||||
|
|
||||||
ismoved = true;
|
|
||||||
if ( !documentMoveTimer ) {
|
|
||||||
documentMoveTimer = setInterval(function(){
|
|
||||||
if ( !ismoved ) {
|
|
||||||
// $('#btn-left').fadeOut();
|
|
||||||
// $('#btn-right').fadeOut();
|
|
||||||
clearInterval(documentMoveTimer);
|
|
||||||
documentMoveTimer = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
ismoved = false;
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var ismodalshown = false;
|
|
||||||
$(document.body).on('show.bs.modal', '.modal',
|
|
||||||
function(e) {
|
|
||||||
ismodalshown = true;
|
|
||||||
api.asc_enableKeyEvents(false);
|
|
||||||
}
|
|
||||||
).on('hidden.bs.modal', '.modal',
|
|
||||||
function(e) {
|
|
||||||
ismodalshown = false;
|
|
||||||
api.asc_enableKeyEvents(true);
|
|
||||||
}
|
|
||||||
).on('hidden.bs.dropdown', '.dropdown',
|
|
||||||
function(e) {
|
|
||||||
if ( !ismodalshown )
|
|
||||||
api.asc_enableKeyEvents(true);
|
|
||||||
}
|
|
||||||
).on('blur', 'input, textarea',
|
|
||||||
function(e) {
|
|
||||||
if ( !ismodalshown ) {
|
|
||||||
if (!/area_id/.test(e.target.id) ) {
|
|
||||||
api.asc_enableKeyEvents(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$('#editor_sdk').on('click', function(e) {
|
$('#editor_sdk').on('click', function(e) {
|
||||||
if ( e.target.localName == 'canvas' ) {
|
if ( e.target.localName == 'canvas' ) {
|
||||||
e.currentTarget.focus();
|
e.currentTarget.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn-play').on('click', onPlayStart);
|
|
||||||
Common.Gateway.documentReady();
|
Common.Gateway.documentReady();
|
||||||
//Common.Analytics.trackEvent('Load', 'Complete');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEditorPermissions(params) {
|
function onEditorPermissions(params) {
|
||||||
if ( (params.asc_getLicenseType() === Asc.c_oLicenseResult.Success) && (typeof config.customization == 'object') &&
|
|
||||||
config.customization && config.customization.logo ) {
|
|
||||||
|
|
||||||
var logo = $('#header-logo');
|
|
||||||
if (config.customization.logo.imageEmbedded) {
|
|
||||||
logo.html('<img src="'+config.customization.logo.imageEmbedded+'" style="max-width:124px; max-height:20px;"/>');
|
|
||||||
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.customization.logo.url) {
|
|
||||||
logo.attr('href', config.customization.logo.url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var $parent = labelDocName.parent();
|
|
||||||
var _left_width = $parent.position().left,
|
|
||||||
_right_width = $parent.next().outerWidth();
|
|
||||||
|
|
||||||
if ( _left_width < _right_width )
|
|
||||||
$parent.css('padding-left', _right_width - _left_width);
|
|
||||||
else
|
|
||||||
$parent.css('padding-right', _left_width - _right_width);
|
|
||||||
|
|
||||||
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||||
api.asc_setViewMode(false);
|
api.asc_setViewMode(false);
|
||||||
|
@ -491,38 +241,39 @@ PE.ApplicationController = new(function(){
|
||||||
|
|
||||||
var isplaymode;
|
var isplaymode;
|
||||||
function onPlayStart(e) {
|
function onPlayStart(e) {
|
||||||
if ( !isplaymode ) {
|
/*if ( !isplaymode ) {
|
||||||
$('#box-preview').show();
|
$('#box-preview').show();
|
||||||
api.StartDemonstration('id-preview', currentPage);
|
api.StartDemonstration('id-preview', currentPage);
|
||||||
} else {
|
} else {
|
||||||
isplaymode == 'play' ?
|
isplaymode == 'play' ?
|
||||||
api.DemonstrationPause() : api.DemonstrationPlay();
|
api.DemonstrationPause() : api.DemonstrationPlay();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*isplaymode != 'play' ? ($('#btn-play button').addClass('pause'), isplaymode = 'play') :
|
||||||
|
($('#btn-play button').removeClass('pause'), isplaymode = 'pause');*/
|
||||||
}
|
}
|
||||||
|
|
||||||
isplaymode != 'play' ? ($('#btn-play button').addClass('pause'), isplaymode = 'play') :
|
/*function onPlayStop() {
|
||||||
($('#btn-play button').removeClass('pause'), isplaymode = 'pause');
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPlayStop() {
|
|
||||||
isplaymode = undefined;
|
isplaymode = undefined;
|
||||||
$('#page-number').val(currentPage + 1);
|
$('#page-number').val(currentPage + 1);
|
||||||
$('#btn-play button').removeClass('pause');
|
//$('#btn-play button').removeClass('pause');
|
||||||
$('#box-preview').hide();
|
$('#box-preview').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaySlideChanged(number) {
|
function onPlaySlideChanged(number) {
|
||||||
if ( number++ < maxPages)
|
if ( number++ < maxPages)
|
||||||
$('#page-number').val(number);
|
$('#page-number').val(number);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
function onError(id, level, errData) {
|
function onError(id, level, errData) {
|
||||||
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
|
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
|
||||||
$('#id-critical-error-title').text(me.criticalErrorTitle);
|
/*$('#id-critical-error-title').text(me.criticalErrorTitle);
|
||||||
$('#id-critical-error-message').text(me.scriptLoadError);
|
$('#id-critical-error-message').text(me.scriptLoadError);
|
||||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
$('#id-critical-error-dialog').css('z-index', 20002).modal('show');
|
$('#id-critical-error-dialog').css('z-index', 20002).modal('show');*/
|
||||||
|
console.error(me.scriptLoadError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,144 +337,148 @@ PE.ApplicationController = new(function(){
|
||||||
if (level == Asc.c_oAscError.Level.Critical) {
|
if (level == Asc.c_oAscError.Level.Critical) {
|
||||||
|
|
||||||
// report only critical errors
|
// report only critical errors
|
||||||
Common.Gateway.reportError(id, message);
|
console.error(id,message);
|
||||||
|
/*Common.Gateway.reportError(id, message);
|
||||||
|
|
||||||
$('#id-critical-error-title').text(me.criticalErrorTitle);
|
$('#id-crical-error-title').text(me.criticalErrorTitle);
|
||||||
$('#id-critical-error-message').html(message);
|
$('#id-critical-error-message').html(message);
|
||||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Common.Gateway.reportWarning(id, message);
|
console.warn(id,message);
|
||||||
|
/*Common.Gateway.reportWarning(id, message);
|
||||||
|
|
||||||
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
|
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
|
||||||
$('#id-critical-error-message').html(message);
|
$('#id-critical-error-message').html(message);
|
||||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||||
$('#id-critical-error-dialog').modal('hide');
|
$('#id-critical-error-dialog').modal('hide');
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#id-critical-error-dialog').modal('show');
|
//$('#id-critical-error-dialog').modal('show');
|
||||||
|
|
||||||
//Common.Analytics.trackEvent('Internal Error', id.toString());
|
//Common.Analytics.trackEvent('Internal Error', id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExternalMessage(error) {
|
function onExternalMessage(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
hidePreloader();
|
hidePreloader();
|
||||||
$('#id-error-mask-title').text(me.criticalErrorTitle);
|
/*$('#id-error-mask-title').text(me.criticalErrorTitle);
|
||||||
$('#id-error-mask-text').text(error.msg);
|
$('#id-error-mask-text').text(error.msg);
|
||||||
$('#id-error-mask').css('display', 'block');
|
$('#id-error-mask').css('display', 'block');*/
|
||||||
|
console.error(error.msg);
|
||||||
|
|
||||||
//Common.Analytics.trackEvent('External Error');
|
//Common.Analytics.trackEvent('External Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onProcessMouse(data) {
|
function onProcessMouse(data) {
|
||||||
if (data.type == 'mouseup') {
|
if (data.type == 'mouseup') {
|
||||||
var e = document.getElementById('editor_sdk');
|
var e = document.getElementById('editor_sdk');
|
||||||
if (e) {
|
if (e) {
|
||||||
var r = e.getBoundingClientRect();
|
var r = e.getBoundingClientRect();
|
||||||
api.OnMouseUp(
|
api.OnMouseUp(
|
||||||
data.x - r.left,
|
data.x - r.left,
|
||||||
data.y - r.top
|
data.y - r.top
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRequestClose() {
|
function onRequestClose() {
|
||||||
Common.Gateway.requestClose();
|
Common.Gateway.requestClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDownloadAs() {
|
function onDownloadAs() {
|
||||||
if ( permissions.download === false) {
|
if ( permissions.download === false) {
|
||||||
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
//Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||||
return;
|
console.error(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||||
}
|
return;
|
||||||
if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true));
|
}
|
||||||
}
|
if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, false));
|
||||||
|
}
|
||||||
|
|
||||||
function onRunAutostartMacroses() {
|
function onRunAutostartMacroses() {
|
||||||
if (!config.customization || (config.customization.macros!==false))
|
if (!config.customization || (config.customization.macros!==false))
|
||||||
if (api) api.asc_runAutostartMacroses();
|
if (api) api.asc_runAutostartMacroses();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeUnload () {
|
function onBeforeUnload () {
|
||||||
common.localStorage.save();
|
common.localStorage.save();
|
||||||
}
|
}
|
||||||
// Helpers
|
// Helpers
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
function onDocumentResize() {
|
function onDocumentResize() {
|
||||||
if (api) {
|
if (api) {
|
||||||
api.Resize();
|
api.Resize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createController(){
|
function createController(){
|
||||||
if (created)
|
if (created)
|
||||||
return me;
|
return me;
|
||||||
|
|
||||||
me = this;
|
me = this;
|
||||||
created = true;
|
created = true;
|
||||||
|
|
||||||
// popover ui handlers
|
// popover ui handlers
|
||||||
|
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
onDocumentResize();
|
onDocumentResize();
|
||||||
});
|
});
|
||||||
window.onbeforeunload = onBeforeUnload;
|
window.onbeforeunload = onBeforeUnload;
|
||||||
|
|
||||||
api = new Asc.asc_docs_api({
|
api = new Asc.asc_docs_api({
|
||||||
'id-view' : 'editor_sdk',
|
'id-view' : 'editor_sdk',
|
||||||
'embedded' : true
|
'embedded' : true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (api){
|
if (api){
|
||||||
api.SetThemesPath("../../../../sdkjs/slide/themes/");
|
api.SetThemesPath("../../../../sdkjs/slide/themes/");
|
||||||
|
|
||||||
api.asc_registerCallback('asc_onError', onError);
|
api.asc_registerCallback('asc_onError', onError);
|
||||||
api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
|
api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
|
||||||
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
|
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
|
||||||
api.asc_registerCallback('asc_onCountPages', onCountPages);
|
//api.asc_registerCallback('asc_onCountPages', onCountPages);
|
||||||
api.asc_registerCallback('asc_onCurrentPage', onCurrentPage);
|
//api.asc_registerCallback('asc_onCurrentPage', onCurrentPage);
|
||||||
|
|
||||||
// Initialize api gateway
|
// Initialize api gateway
|
||||||
Common.Gateway.on('init', loadConfig);
|
Common.Gateway.on('init', loadConfig);
|
||||||
Common.Gateway.on('opendocument', loadDocument);
|
Common.Gateway.on('opendocument', loadDocument);
|
||||||
Common.Gateway.on('showmessage', onExternalMessage);
|
Common.Gateway.on('showmessage', onExternalMessage);
|
||||||
Common.Gateway.appReady();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
create : createController,
|
create : createController,
|
||||||
errorDefaultMessage : 'Error code: %1',
|
errorDefaultMessage : 'Error code: %1',
|
||||||
unknownErrorText : 'Unknown error.',
|
unknownErrorText : 'Unknown error.',
|
||||||
convertationTimeoutText : 'Conversion timeout exceeded.',
|
convertationTimeoutText : 'Conversion timeout exceeded.',
|
||||||
convertationErrorText : 'Conversion failed.',
|
convertationErrorText : 'Conversion failed.',
|
||||||
downloadErrorText : 'Download failed.',
|
downloadErrorText : 'Download failed.',
|
||||||
criticalErrorTitle : 'Error',
|
criticalErrorTitle : 'Error',
|
||||||
notcriticalErrorTitle : 'Warning',
|
notcriticalErrorTitle : 'Warning',
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||||
errorFilePassProtect: 'The file is password protected and cannot be opened.',
|
errorFilePassProtect: 'The file is password protected and cannot be opened.',
|
||||||
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
|
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
|
||||||
errorUserDrop: 'The file cannot be accessed right now.',
|
errorUserDrop: 'The file cannot be accessed right now.',
|
||||||
unsupportedBrowserErrorText: 'Your browser is not supported.',
|
unsupportedBrowserErrorText: 'Your browser is not supported.',
|
||||||
textOf: 'of',
|
textOf: 'of',
|
||||||
downloadTextText: 'Downloading presentation...',
|
downloadTextText: 'Downloading presentation...',
|
||||||
waitText: 'Please, wait...',
|
waitText: 'Please, wait...',
|
||||||
textLoadingDocument: 'Loading presentation',
|
textLoadingDocument: 'Loading presentation',
|
||||||
txtClose: 'Close',
|
txtClose: 'Close',
|
||||||
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
|
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
|
||||||
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
|
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
|
||||||
textGuest: 'Guest',
|
textGuest: 'Guest',
|
||||||
textAnonymous: 'Anonymous',
|
textAnonymous: 'Anonymous',
|
||||||
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",
|
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",
|
||||||
errorLoadingFont: 'Fonts are not loaded.<br>Please contact your Document Server administrator.'
|
errorLoadingFont: 'Fonts are not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -35,41 +35,12 @@ if (PE === undefined) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PE.ApplicationView = new(function(){
|
PE.ApplicationView = new(function(){
|
||||||
var $btnTools;
|
|
||||||
|
|
||||||
// Initialize view
|
// Initialize view
|
||||||
|
|
||||||
function createView(){
|
function createView(){
|
||||||
$btnTools = $('#box-tools button');
|
|
||||||
|
|
||||||
$btnTools.addClass('dropdown-toggle').attr('data-toggle', 'dropdown').attr('aria-expanded', 'true');
|
|
||||||
$btnTools.parent().append(
|
|
||||||
'<ul class="dropdown-menu pull-right">' +
|
|
||||||
'<li><a id="idt-print"><span class="mi-icon svg-icon print"></span>' + this.txtPrint + '</a></li>' +
|
|
||||||
'<li><a id="idt-download"><span class="mi-icon svg-icon download"></span>' + this.txtDownload + '</a></li>' +
|
|
||||||
'<li><a id="idt-share" data-toggle="modal"><span class="mi-icon svg-icon share"></span>' + this.txtShare + '</a></li>' +
|
|
||||||
'<li><a id="idt-close" data-toggle="modal"><span class="mi-icon svg-icon go-to-location"></span>' + this.txtFileLocation + '</a></li>' +
|
|
||||||
'<li class="divider"></li>' +
|
|
||||||
'<li><a id="idt-embed" data-toggle="modal"><span class="mi-icon svg-icon embed"></span>' + this.txtEmbed + '</a></li>' +
|
|
||||||
'<li><a id="idt-fullscreen"><span class="mi-icon svg-icon fullscr"></span>' + this.txtFullScreen + '</a></li>' +
|
|
||||||
'</ul>');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTools(name) {
|
|
||||||
return $btnTools.parent().find(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
create: createView
|
create: createView
|
||||||
, tools: {
|
|
||||||
get: getTools
|
|
||||||
},
|
|
||||||
|
|
||||||
txtDownload: 'Download',
|
|
||||||
txtPrint: 'Print',
|
|
||||||
txtShare: 'Share',
|
|
||||||
txtEmbed: 'Embed',
|
|
||||||
txtFullScreen: 'Full Screen',
|
|
||||||
txtFileLocation: 'Open file location'
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
call npm install less
|
|
||||||
call npm install watchr
|
|
|
@ -1,75 +0,0 @@
|
||||||
(function() {
|
|
||||||
var path = require('path'),
|
|
||||||
util = require('util'),
|
|
||||||
fs = require('fs'),
|
|
||||||
watchr = require('watchr'),
|
|
||||||
less = require('less'),
|
|
||||||
cwd = process.cwd(),
|
|
||||||
watchPath = process.argv.length === 3 ? path.resolve(cwd, process.argv[2]) : cwd;
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
compress: false,
|
|
||||||
yuicompress: false,
|
|
||||||
optimization: 1,
|
|
||||||
silent: false,
|
|
||||||
paths: [],
|
|
||||||
color: true,
|
|
||||||
strictImports: false
|
|
||||||
};
|
|
||||||
|
|
||||||
var parseLessFile = function(input, output){
|
|
||||||
return function (e, data) {
|
|
||||||
if (e) {
|
|
||||||
console.log('lessc:', e.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
new(less.Parser)({
|
|
||||||
paths: [path.dirname(input)],
|
|
||||||
optimization: options.optimization,
|
|
||||||
filename: input
|
|
||||||
}).parse(data, function (err, tree) {
|
|
||||||
if (err) {
|
|
||||||
less.writeError(err, options);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
var css = tree.toCSS({ compress: options.compress });
|
|
||||||
if (output) {
|
|
||||||
var fd = fs.openSync(output, "w");
|
|
||||||
fs.writeSync(fd, css, 0, "utf8");
|
|
||||||
} else {
|
|
||||||
console.log('WARNING: output is undefined');
|
|
||||||
util.print(css);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
less.writeError(e, options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('>>> Script is polling for changes. Press Ctrl-C to Stop.');
|
|
||||||
|
|
||||||
watchr.watch({
|
|
||||||
path: watchPath,
|
|
||||||
listener: function(eventName, filePath, fileCurrentStat, filePreviousStat) {
|
|
||||||
if (eventName == 'change' || eventName == 'update') {
|
|
||||||
console.log('>>> Change detected at', new Date().toLocaleTimeString(), 'to:', path.basename(filePath));
|
|
||||||
|
|
||||||
var baseFilePath = path.basename(filePath, '.less');
|
|
||||||
fs.readFile(filePath, 'utf-8', parseLessFile(filePath, '../css/' + baseFilePath + '.css'));
|
|
||||||
|
|
||||||
console.log('overwrite', baseFilePath + '.css');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
next: function(err, watcher) {
|
|
||||||
if (err) {
|
|
||||||
console.log('!!! epic fail');
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Now watching:', watchPath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
})();
|
|
Loading…
Reference in a new issue