From 50d1b609baa7f06b4c9bc5f43dc5d220ee1a432f Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Tue, 28 Jun 2016 17:00:58 +0530 Subject: [PATCH] Move exist button to top right of revision sidebar --- css/style.css | 7 +++++++ js/documents.js | 19 +++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/css/style.css b/css/style.css index 51c7cecf..5257c86e 100644 --- a/css/style.css +++ b/css/style.css @@ -215,6 +215,13 @@ margin: 0 0; } +/* For close button image */ +#revPanelHeader img{ + position: absolute; + right: 5px; + top: 10px; +} + .loleaflet-font{ font-family: "Segoe UI", Tahoma, Arial, Helvetica, sans-serif !important; } diff --git a/js/documents.js b/js/documents.js index c81b27ff..3739ff2b 100644 --- a/js/documents.js +++ b/js/documents.js @@ -208,6 +208,7 @@ var documentsMain = { '
' + '

Revision History

' + '{{filename}}' + + '' + '
' + '
' + '' + @@ -250,7 +251,6 @@ var documentsMain = { var urlsrc = $('li[data-id='+ fileId.replace(/_.*/, '') +']>a').attr('urlsrc') + "WOPISrc=" + wopisrc + "&title=" + encodeURIComponent(title) + - "&closebutton=1" + "&permission=readonly"; // access_token - must be passed via a form post @@ -265,19 +265,17 @@ var documentsMain = { $('#revViewer').append(form); $('#revViewer').append(frame); - // handler for the 'Close' button - we have enabled it via closebutton=1 - $('#loleafletframe_viewer').load(function(){ - window.addEventListener('message', function(e){ - if (e.data === 'close') { - documentsMain.onCloseViewer(); - } - }); - }); // submit that $('#loleafletform_viewer').submit(); documentsMain.isViewerMode = true; }); + + // for closing revision mode + $('#revPanelHeader .closeButton').click(function(e) { + e.preventDefault(); + documentsMain.onCloseViewer(); + }); }, addRevision: function(fileId, version, relativeTimestamp, documentPath) { @@ -335,7 +333,8 @@ var documentsMain = { var revHistoryContainerTemplate = Handlebars.compile(documentsMain.UI.revHistoryContainerTemplate); var revHistoryContainer = revHistoryContainerTemplate({ filename: documentsMain.fileName, - moreVersionsLabel: t('richdocuments', 'More versions...') + moreVersionsLabel: t('richdocuments', 'More versions...'), + closeButtonUrl: OC.imagePath('core', 'actions/close') }); $(document.body).prepend(revHistoryContainer);