From 960d5850d4e06e8434784f5dc90d7147cee9b943 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Thu, 3 Nov 2016 18:22:26 +0300 Subject: [PATCH] [PE embed] updated embed viewer --- .../embed/resources/img/icon-menu-sprite.svg | 73 +- apps/common/embed/resources/less/common.less | 16 +- apps/presentationeditor/embed/index.html | 47 +- .../embed/js/ApplicationController.js | 651 +++++++----------- .../embed/js/ApplicationView.js | 51 +- .../embed/js/application.js | 6 +- .../embed/resources/less/application.less | 29 +- 7 files changed, 353 insertions(+), 520 deletions(-) diff --git a/apps/common/embed/resources/img/icon-menu-sprite.svg b/apps/common/embed/resources/img/icon-menu-sprite.svg index 8b51a6cbe..a11157f7f 100644 --- a/apps/common/embed/resources/img/icon-menu-sprite.svg +++ b/apps/common/embed/resources/img/icon-menu-sprite.svg @@ -1,51 +1,50 @@ - - - - - + viewBox="88 -11 242 44" style="enable-background:new 88 -11 242 44;" xml:space="preserve"> - - + + - + c0,1.7,1.4,3.1,3.1,3.1c1.7,0,3.1-1.4,3.1-3.1C150.4,4.4,149,3,147.3,3z"/> - - - - + + - - + + - - + + + + + + + + + - - - - - - - - - + + + + + + + diff --git a/apps/common/embed/resources/less/common.less b/apps/common/embed/resources/less/common.less index 5d48fe524..6eca02410 100644 --- a/apps/common/embed/resources/less/common.less +++ b/apps/common/embed/resources/less/common.less @@ -548,7 +548,7 @@ .svg-icon { background: data-uri('../../../../common/embed/resources/img/icon-menu-sprite.svg') no-repeat; - background-size: 22px*9 22px*2; + background-size: 22px*11 22px*2; &.download { background-position: -22px 0; @@ -568,6 +568,20 @@ &.zoom-down { background-position: -22px*6 -22px; } + &.slide-prev { + background-position: -22px*7 -22px; + } + &.slide-next { + background-position: -22px*8 -22px; + } + + &.play { + background-position: -22px*9 -22px; + } + + &.pause { + background-position: -22px*10 -22px; + } } .mi-icon { diff --git a/apps/presentationeditor/embed/index.html b/apps/presentationeditor/embed/index.html index f7052dd63..58055d2ae 100644 --- a/apps/presentationeditor/embed/index.html +++ b/apps/presentationeditor/embed/index.html @@ -192,11 +192,6 @@ - -
- - - -
+
+
+
+
- - +
+ +
+
+ +
+
+
of 0
+
+
+
+ + - @@ -335,6 +335,9 @@ + + + diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 815037702..71039061e 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -38,14 +38,9 @@ var ApplicationController = new(function(){ embedConfig = {}, permissions = {}, maxPages = 0, - minToolbarWidth = 550, - minEmbedWidth = 400, - minEmbedHeight = 600, - embedCode = '', - maxZIndex = 9090, created = false, currentPage = 0, - iframePrint = null; + ttOffset = [0, -10]; // Initialize analytics // ------------------------- @@ -61,52 +56,6 @@ var ApplicationController = new(function(){ return; } - - // Initialize ZeroClipboard - // ------------------------- - - ZeroClipboard.setMoviePath('../../../vendor/ZeroClipboard/ZeroClipboard10.swf'); - var clipShortUrl = new ZeroClipboard.Client(); - var clipEmbedObj = new ZeroClipboard.Client(); - clipShortUrl.zIndex = maxZIndex; - clipEmbedObj.zIndex = maxZIndex; - - - // Utils - // ------------------------- - - function emptyFn(){} - - function createBuffered(fn, buffer, scope, args) { - return function(){ - var timerId; - return function() { - var me = this; - if (timerId) { - clearTimeout(timerId); - timerId = null; - } - timerId = setTimeout(function(){ - fn.apply(scope || me, args || arguments); - }, buffer); - }; - }(); - } - - function updateSocial() { - var $socialPanel = $('#id-popover-social-container'); - - if ($socialPanel.length > 0) { - if ($socialPanel.attr('data-loaded') == 'false') { - typeof FB !== 'undefined' && FB.XFBML && FB.XFBML.parse(); - typeof twttr !== 'undefined' && twttr.widgets && twttr.widgets.load(); - - $socialPanel.attr('data-loaded', 'true'); - } - } - } - - // Handlers // ------------------------- @@ -114,37 +63,7 @@ var ApplicationController = new(function(){ config = $.extend(config, data.config); embedConfig = $.extend(embedConfig, data.config.embedded); - $('#id-short-url').val(embedConfig.shareUrl || 'Unavailable'); - $('#id-textarea-embed').text(embedCode.replace('{embed-url}', embedConfig.embedUrl).replace('{width}', minEmbedWidth).replace('{height}', minEmbedHeight)); - - if (typeof embedConfig.shareUrl !== 'undefined' && embedConfig.shareUrl != ''){ - (function(d, s, id) { - var js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) return; - js = d.createElement(s); js.id = id; - js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; - fjs.parentNode.insertBefore(js, fjs); - }(document, 'script', 'facebook-jssdk')); - !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); - - if ($('#id-popover-social-container ul')){ - $('#id-popover-social-container ul').append('
  • '); - $('#id-popover-social-container ul').append('
  • '); //data-count="none" - $('#id-popover-social-container ul').append('
  • Email
  • '); - } - } - if (typeof embedConfig.shareUrl === 'undefined') - $('#id-btn-share').hide(); - - if (typeof embedConfig.embedUrl === 'undefined') - $('#id-btn-embed').hide(); - - if (typeof embedConfig.fullscreenUrl === 'undefined') - $('#id-btn-fullscreen').hide(); - - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) - $('#id-btn-close').hide(); - + common.controller.modals.init(embedConfig); // Docked toolbar if (embedConfig.toolbarDocked === 'top') { @@ -153,10 +72,14 @@ var ApplicationController = new(function(){ } else { $('#toolbar').addClass('bottom'); $('#editor_sdk').addClass('bottom'); + $('#box-tools').removeClass('dropdown').addClass('dropup'); + ttOffset[1] = -40; } - // Hide last separator - if (!$('#id-btn-fullscreen').is(":visible") && !$('#id-btn-close').is(":visible")) { + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) { + $('#id-btn-close').hide(); + + // Hide last separator $('#toolbar .right .separator').hide(); $('#pages').css('margin-right', '12px'); } @@ -184,11 +107,8 @@ var ApplicationController = new(function(){ Common.Analytics.trackEvent('Load', 'Start'); } - if (typeof embedConfig.saveUrl === 'undefined' && permissions.print === false) - $('#id-btn-copy').hide(); - - if (!$('#id-btn-copy').is(":visible") && !$('#id-btn-share').is(":visible") && !$('#id-btn-embed').is(":visible") ) - $('#toolbar .left .separator').hide(); + if (!embedConfig.saveUrl && permissions.print === false) + $('#idt-copy').hide(); } } @@ -202,14 +122,6 @@ var ApplicationController = new(function(){ currentPage = number; } - function onHyperlinkClick(url) { - if (url) { - var newDocumentPage = window.open(url, '_blank'); - if (newDocumentPage) - newDocumentPage.focus(); - } - } - function onLongActionBegin(type, id) { var text = ''; switch (id) @@ -236,12 +148,12 @@ var ApplicationController = new(function(){ me.isHideBodyTip = true; } + var $ttEl, $tooltip; function onDocMouseMoveEnd() { if (me.isHideBodyTip) { - var $tipHyperlink = $('#id-tip-hyperlink'); - - if ($tipHyperlink.length > 0) { - $tipHyperlink.hide(); + if ( $tooltip ) { + $tooltip.tooltip('hide'); + $tooltip = false; } } } @@ -251,19 +163,30 @@ var ApplicationController = new(function(){ if (data.get_Type() == 1) { // hyperlink me.isHideBodyTip = false; - var $tipHyperlink = $('#id-tip-hyperlink'), - hyperProps = data.get_Hyperlink(), - toolTip = (hyperProps.get_ToolTip()) ? hyperProps.get_ToolTip() : hyperProps.get_Value(); + if ( !$ttEl ) { + $ttEl = $('.hyperlink-tooltip'); + $ttEl.tooltip({'container':'body', 'trigger':'manual'}); + $ttEl.on('shown.bs.tooltip', function(e) { + $tooltip = $ttEl.data('bs.tooltip').tip(); - if ($tipHyperlink.length > 0) { - $tipHyperlink.find('.popover-content p').html(htmlEncode(toolTip) + '
    Press Ctrl and click link'); - $tipHyperlink.show(); + $tooltip.css({ + left: $ttEl.ttpos[0] + ttOffset[0], + top: $ttEl.ttpos[1] + ttOffset[1] + }); + + $tooltip.find('.tooltip-arrow').css({left: 10}); + }); } - $tipHyperlink.css({ - left: data.get_X() - 10, - top : data.get_Y() - 25 - }) + 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] + }); + } } } } @@ -273,32 +196,12 @@ var ApplicationController = new(function(){ } function onPrint() { - if (api && permissions.print!==false) + if (permissions.print!==false) api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera); } function onPrintUrl(url) { - if (iframePrint) { - iframePrint.parentNode.removeChild(iframePrint); - iframePrint = null; - } - if (!iframePrint) { - iframePrint = document.createElement("iframe"); - iframePrint.id = "id-print-frame"; - iframePrint.style.display = 'none'; - iframePrint.style.visibility = "hidden"; - iframePrint.style.position = "fixed"; - iframePrint.style.right = "0"; - iframePrint.style.bottom = "0"; - document.body.appendChild(iframePrint); - iframePrint.onload = function() { - iframePrint.contentWindow.focus(); - iframePrint.contentWindow.print(); - iframePrint.contentWindow.blur(); - window.focus(); - }; - } - if (url) iframePrint.src = url; + common.utils.dialogPrint(url); } function hidePreloader() { @@ -306,19 +209,170 @@ var ApplicationController = new(function(){ } function onDocumentContentReady() { - setVisiblePopover($('#id-popover-share'), false); - setVisiblePopover($('#id-popover-embed'), false); - $('#id-tip-hyperlink').hide(); - - handlerToolbarSize(); - - if (api) { - api.ShowThumbnails(false); - api.asc_DeleteVerticalScroll(); - } + api.ShowThumbnails(false); + api.asc_DeleteVerticalScroll(); hidePreloader(); + if ( !embedConfig.shareUrl ) + $('#idt-share').hide(); + + if ( !embedConfig.embedUrl ) + $('#idt-embed').hide(); + + if ( !embedConfig.fullscreenUrl ) + $('#idt-fullscr').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_onPrint', onPrint); + api.asc_registerCallback('asc_onPrintUrl', onPrintUrl); + api.asc_registerCallback('asc_onHyperlinkClick', common.utils.openLink); + api.asc_registerCallback('asc_onStartAction', onLongActionBegin); + api.asc_registerCallback('asc_onEndAction', onLongActionEnd); + + api.asc_registerCallback('asc_onEndDemonstration', onPlayStop); + api.asc_registerCallback('asc_onDemonstrationSlideChanged', onPlaySlideChanged); + + Common.Gateway.on('processmouse', onProcessMouse); + Common.Gateway.on('downloadas', onDownloadAs); + + ApplicationView.tools.get('#idt-fullscreen') + .on('click', function(){ + common.utils.openLink(embedConfig.fullscreenUrl); + }); + + 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($.browser.chrome || $.browser.safari || $.browser.opera); + } + + Common.Analytics.trackEvent('Save'); + }); + + var $pagenum = $('#page-number'); + $pagenum.on({ + 'keyup': function(e){ + if ( e.keyCode == 13 ){ + var newPage = parseInt($('#page-number').val()); + + if ( newPage > maxPages ) newPage = maxPages; else + if ( newPage < 2 || isNaN(newPage) ) newPage = 1; + + if ( isplaymode ) + 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(); + }); + + $('#id-btn-close').on('click', function(){ + if (config.customization && config.customization.goback && config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + }); + + $('#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) { + if ( e.target.localName == 'canvas' ) { + e.currentTarget.focus(); + } + }); + + $('#btn-play').on('click', onPlayStart); Common.Analytics.trackEvent('Load', 'Complete'); } @@ -342,6 +396,40 @@ var ApplicationController = new(function(){ api.zoomFitToPage(); } + function onOpenDocument(progress) { + var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); + $('#loadmask-text').html('Loading document: ' + Math.min(Math.round(proc * 100), 100) + '%'); + } + + var isplaymode; + function onPlayStart(e) { + if ( !isplaymode ) { + if ( isplaymode === undefined ) { + $('#box-preview').show(); + api.StartDemonstration('id-preview', currentPage); + } else + api.DemonstrationPlay(); + + $('#btn-play button').addClass('pause'); + } else { + $('#btn-play button').removeClass('pause'); + api.DemonstrationPause(); + } + isplaymode = !isplaymode; + } + + function onPlayStop() { + isplaymode = undefined; + $('#page-number').val(currentPage + 1); + $('#btn-play button').removeClass('pause'); + $('#box-preview').hide(); + } + + function onPlaySlideChanged(number) { + if ( number++ < maxPages) + $('#page-number').val(number); + } + function showMask() { $('#id-loadmask').modal({ backdrop: 'static', @@ -353,11 +441,6 @@ var ApplicationController = new(function(){ $('#id-loadmask').modal('hide'); } - function onOpenDocument(progress) { - var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); - $('#loadmask-text').html('Loading document: ' + Math.min(Math.round(proc * 100), 100) + '%'); - } - function onError(id, level, errData) { hidePreloader(); @@ -442,114 +525,11 @@ var ApplicationController = new(function(){ // Helpers // ------------------------- - var handlerToolbarSize = createBuffered(function(size){ - var visibleCaption = function(btn, visible){ - if (visible){ - $(btn + ' button').addClass('no-caption'); - $(btn + ' button span').css('display', 'none'); - } else { - $(btn + ' button').removeClass('no-caption'); - $(btn + ' button span').css('display', 'inline'); - } - }; - - var isMinimize = $('#toolbar').width() < minToolbarWidth; - - visibleCaption('#id-btn-copy', isMinimize); - visibleCaption('#id-btn-share', isMinimize); - visibleCaption('#id-btn-embed', isMinimize); - }, 10); - function onDocumentResize() { if (api) { api.Resize(); api.zoomFitToPage(); } - - handlerToolbarSize(); - } - - function isVisiblePopover(popover){ - return popover.hasClass('in'); - } - - function setVisiblePopover(popover, visible, owner){ - api && api.asc_enableKeyEvents(!visible); - - if (visible){ - if (owner){ - popover.css('display', 'block'); - - var popoverData = owner.data('bs.popover'), - $tip = popoverData.tip(), - pos = popoverData.getPosition(false), - actualHeight = $tip[0].offsetHeight, - placement = (embedConfig.toolbarDocked === 'top') ? 'bottom' : 'top', - tp; - - $tip.removeClass('fade in top bottom left right'); - - switch (placement) { - case 'bottom': - tp = { - top : pos.top + pos.height, - left: owner.position().left + (owner.width() - popover.width()) * 0.5 - }; - break; - - default: - case 'top': - tp = { - top : pos.top - actualHeight, - left: owner.position().left + (owner.width() - popover.width()) * 0.5 - }; - break; - - } - - $tip - .css(tp) - .addClass(placement) - .addClass('in') - } - - if (popover.hasClass('embed')) { - clipEmbedObj.show(); - } - - if (popover.hasClass('share')) { - clipShortUrl.show(); - updateSocial(); - } - } else { - popover.removeClass('in'); - popover.css('display', 'none'); - - popover.hasClass('embed') && clipEmbedObj.hide(); - popover.hasClass('share') && clipShortUrl.hide(); - } - } - - function updateEmbedCode(){ - var newWidth = parseInt($('#id-input-embed-width').val()), - newHeight = parseInt($('#id-input-embed-height').val()); - - if (newWidth < minEmbedWidth) - newWidth = minEmbedWidth; - - if (newHeight < minEmbedHeight) - newHeight = minEmbedHeight; - - $('#id-textarea-embed').text(embedCode.replace('{embed-url}', embedConfig.embedUrl).replace('{width}', newWidth).replace('{height}', newHeight)); - - $('#id-input-embed-width').val(newWidth + 'px'); - $('#id-input-embed-height').val(newHeight + 'px'); - } - - function openLink(url){ - var newDocumentPage = window.open(url); - if (newDocumentPage) - newDocumentPage.focus(); } function createController(){ @@ -559,165 +539,12 @@ var ApplicationController = new(function(){ me = this; created = true; - var documentMoveTimer; - - // Initialize clipboard objects - - clipShortUrl.addEventListener('mousedown', function() { - if ($('#id-btn-copy-short').hasClass('copied')) - return; - - $('#id-btn-copy-short').button('copied'); - $('#id-btn-copy-short').addClass('copied'); - - clipShortUrl.setText($('#id-short-url').val()); - - setTimeout(function(){ - $('#id-btn-copy-short').button('reset'); - $('#id-btn-copy-short').removeClass('copied'); - }, 2000); - }); - - clipEmbedObj.addEventListener('mousedown', function(){ - if ($('#id-btn-copy-embed').hasClass('copied')) - return; - - $('#id-btn-copy-embed').button('copied'); - $('#id-btn-copy-embed').addClass('copied'); - - clipEmbedObj.setText($('#id-textarea-embed').text()); - - setTimeout(function(){ - $('#id-btn-copy-embed').button('reset'); - $('#id-btn-copy-embed').removeClass('copied'); - }, 2000); - }); - - clipShortUrl.glue('id-btn-copy-short'); - clipEmbedObj.glue('id-btn-copy-embed'); - - // popover ui handlers - $('#id-btn-copy').on('click', function(){ - var saveUrl = embedConfig.saveUrl; - if (typeof saveUrl !== 'undefined' && saveUrl.length > 0){ - openLink(saveUrl); - } else if (api && permissions.print!==false){ - api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera); - } - - Common.Analytics.trackEvent('Save'); - }); - - $('#id-btn-share').on('click', function(event){ - setVisiblePopover($('#id-popover-share'), !isVisiblePopover($('#id-popover-share')), $('#id-btn-share')); - setVisiblePopover($('#id-popover-embed'), false); - - event.preventDefault(); - event.stopPropagation(); - }); - - $('#id-btn-embed').on('click', function(event){ - setVisiblePopover($('#id-popover-embed'), !isVisiblePopover($('#id-popover-embed')), $('#id-btn-embed')); - setVisiblePopover($('#id-popover-share'), false); - - event.preventDefault(); - event.stopPropagation(); - }); - - $('#id-input-embed-width').on('keypress', function(e){ - if (e.keyCode == 13) - updateEmbedCode(); - }); - - $('#id-input-embed-height').on('keypress', function(e){ - if (e.keyCode == 13) - updateEmbedCode(); - }); - - $('#id-input-embed-width').on('focusin', function(e){ - api && api.asc_enableKeyEvents(false); - }); - - $('#id-input-embed-height').on('focusin', function(e){ - api && api.asc_enableKeyEvents(false); - }); - - $('#id-input-embed-width').on('focusout', function(e){ - updateEmbedCode(); - api && api.asc_enableKeyEvents(true); - }); - - $('#id-input-embed-height').on('focusout', function(e){ - updateEmbedCode(); - api && api.asc_enableKeyEvents(true); - }); - - $('#page-number').on('keypress', function(e){ - if (e.keyCode == 13){ - var newPage = parseInt($('#page-number').val()); - - if (newPage > maxPages) - newPage = maxPages; - if (newPage < 2 || isNaN(newPage)) - newPage = 1; - - if (api) - api.goToPage(newPage-1); - } - }); - - $('#id-btn-fullscreen').on('click', function(){ - openLink(embedConfig.fullscreenUrl); - }); - - $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; - }); - - $('#id-btn-move-left').on('click', function(){ - if (api) { - if (currentPage > 0) { - api.goToPage(currentPage - 1); - } - } - }); - - $('#id-btn-move-right').on('click', function(){ - if (api) { - if (currentPage < maxPages - 1) { - api.goToPage(currentPage + 1); - } - } - }); - $(window).resize(function(){ onDocumentResize(); }); - $(document).click(function(event){ - if (event && event.target && $(event.target).closest('.popover').length > 0) - return; - - setVisiblePopover($('#id-popover-share'), false); - setVisiblePopover($('#id-popover-embed'), false); - - clearTimeout(documentMoveTimer); - }); - - $(document).mousemove(function(event){ - $('#id-btn-move-left').fadeIn(); - $('#id-btn-move-right').fadeIn(); - - clearTimeout(documentMoveTimer); - documentMoveTimer = setTimeout(function(){ - $('#id-btn-move-left').fadeOut(); - $('#id-btn-move-right').fadeOut(); - }, 2000); - }); - api = new Asc.asc_docs_api({ 'id-view' : 'editor_sdk' }); @@ -729,26 +556,12 @@ var ApplicationController = new(function(){ api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady); api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_registerCallback('asc_onCountPages', onCountPages); -// api.asc_registerCallback('OnCurrentVisiblePage', onCurrentPage); api.asc_registerCallback('asc_onCurrentPage', onCurrentPage); - api.asc_registerCallback('asc_onHyperlinkClick', onHyperlinkClick); - api.asc_registerCallback('asc_onStartAction', onLongActionBegin); - api.asc_registerCallback('asc_onEndAction', onLongActionEnd); - - 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_onPrint', onPrint); - api.asc_registerCallback('asc_onPrintUrl', onPrintUrl); // Initialize api gateway Common.Gateway.on('init', loadConfig); Common.Gateway.on('opendocument', loadDocument); Common.Gateway.on('showerror', onExternalError); - Common.Gateway.on('processmouse', onProcessMouse); - Common.Gateway.on('downloadas', onDownloadAs); Common.Gateway.ready(); } diff --git a/apps/presentationeditor/embed/js/ApplicationView.js b/apps/presentationeditor/embed/js/ApplicationView.js index a42c5c2cc..95981d5e5 100644 --- a/apps/presentationeditor/embed/js/ApplicationView.js +++ b/apps/presentationeditor/embed/js/ApplicationView.js @@ -31,50 +31,31 @@ * */ var ApplicationView = new(function(){ + var $btnTools; // Initialize view function createView(){ - $('#id-btn-share').popover({ - trigger : 'manual', - html : true, - template : '

    ', - content : ' ' + - '
    ' + - '' + - '
    ' - }).popover('show'); + $btnTools = $('#box-tools button'); - $('#id-btn-embed').popover({ - trigger : 'manual', - html : true, - template : '

    ', - content : '
    ' + - 'Width:' + - '' + - '' + - 'Height:' + - '
    ' + - '' + - '' + $btnTools.addClass('dropdown-toggle').attr('data-toggle', 'dropdown').attr('aria-expanded', 'true'); + $btnTools.parent().append( + ''); + } - - }).popover('show'); - - $('body').popover({ - trigger : 'manual', - html : true, - animation : false, - template : '', - content : '
    Press Ctrl and click link' - }).popover('show'); + function getTools(name) { + return $btnTools.parent().find(name); } return { create: createView + , tools: { + get: getTools + } } })(); diff --git a/apps/presentationeditor/embed/js/application.js b/apps/presentationeditor/embed/js/application.js index 541640578..15dede574 100644 --- a/apps/presentationeditor/embed/js/application.js +++ b/apps/presentationeditor/embed/js/application.js @@ -32,9 +32,7 @@ */ (function ($) { - $(function(){ - ApplicationView.create(); - ApplicationController.create(); - }) + ApplicationView.create(); + ApplicationController.create(); })(window.jQuery); diff --git a/apps/presentationeditor/embed/resources/less/application.less b/apps/presentationeditor/embed/resources/less/application.less index d838831f1..90bb790e1 100644 --- a/apps/presentationeditor/embed/resources/less/application.less +++ b/apps/presentationeditor/embed/resources/less/application.less @@ -2,8 +2,33 @@ @import "../../../../common/embed/resources/less/common.less"; .overlay-controls { - bottom: 15px; + /*bottom: 15px;*/ } .overlay-icon-move-left { background-position: -64px -120px; } -.overlay-icon-move-right { background-position: -96px -120px; } \ No newline at end of file +.overlay-icon-move-right { background-position: -96px -120px; } + +#box-preview { + position:absolute; + left: 0; + top: 0; + display:none; + width:100%; + height:100%; + z-index: 10; + padding: 32px 0 0 0; +} + +#id-preview { + width:100%; + height:100%; + position: relative; +} + +.svg-icon { + &.play { + &.pause { + background-position: -22px*10 -22px; + } + } +}