diff --git a/css/cool.css b/css/cool.css index 5b5c6395..1b829c4c 100644 --- a/css/cool.css +++ b/css/cool.css @@ -14,30 +14,30 @@ } .cool-frame__preview { - width: 100%; - height: 100%; - border: 0; + width: 100%; + height: 100%; + border: 0; } .cool-frame__iframe { - border: 1px solid; - width: 100%; - height: 100%; - position: absolute; - box-sizing: border-box; + border: 1px solid; + width: 100%; + height: 100%; + position: absolute; + box-sizing: border-box; } .cool-editor__dialog { - resize: both; - position: fixed; - top: 250px; - width: 100%; - height: calc(100% - 250px); - /* seems to be a reasonable value to be above of it all */ - z-index: 501; - box-sizing: border-box; + resize: both; + position: fixed; + top: 250px; + width: 100%; + height: calc(100% - 250px); + /* seems to be a reasonable value to be above of it all */ + z-index: 501; + box-sizing: border-box; } .cool-editor__body { - margin: 0; + margin: 0; } diff --git a/js/cool.js b/js/cool.js index 95dd249d..80a49dd7 100644 --- a/js/cool.js +++ b/js/cool.js @@ -10,60 +10,60 @@ */ function loadDocument(wopiClient, wopiSrc, options = null) { - let hasCloseButton = false; - let wopiUrl = `${wopiClient}WOPISrc=${wopiSrc}`; - if (options && options.closebutton == true) { - wopiUrl += '&closebutton=true'; - hasCloseButton = true; - } + let hasCloseButton = false; + let wopiUrl = `${wopiClient}WOPISrc=${wopiSrc}`; + if (options && options.closebutton == true) { + wopiUrl += '&closebutton=true'; + hasCloseButton = true; + } - window.addEventListener("message", receiveMessage.bind(null, hasCloseButton), false); + window.addEventListener("message", receiveMessage.bind(null, hasCloseButton), false); - let formElem = document.getElementById("collabora-submit-form"); + let formElem = document.getElementById("collabora-submit-form"); - if (!formElem) { - console.log("error: submit form not found"); - return; - } - formElem.action = wopiUrl; - formElem.submit(); + if (!formElem) { + console.log("error: submit form not found"); + return; + } + formElem.action = wopiUrl; + formElem.submit(); } function postMessage(msg) { - document.getElementById("collabora-online-viewer").contentWindow.postMessage(JSON.stringify(msg), '*'); + document.getElementById("collabora-online-viewer").contentWindow.postMessage(JSON.stringify(msg), '*'); } function postReady() { - postMessage({ MessageId: "Host_PostmessageReady" }); + postMessage({ MessageId: "Host_PostmessageReady" }); } function receiveMessage(hasCloseButton, event) { - let msg = JSON.parse(event.data); - if (!msg) { - return; - } + let msg = JSON.parse(event.data); + if (!msg) { + return; + } - switch (msg.MessageId) { + switch (msg.MessageId) { case "App_LoadingStatus": - if (msg.Values && msg.Values.Status == "Document_Loaded") { - postReady(); - } - break; + if (msg.Values && msg.Values.Status == "Document_Loaded") { + postReady(); + } + break; case "UI_Close": - if (hasCloseButton) { - if (msg.Values && msg.Values.EverModified) { - let reply = { MessageId: "Action_Close" }; - postMessage(reply); - } - if (window.parent.location == window.location) { - history.back(); - } else { - /* we send back the UI_Close message to the parent frame. */ - window.parent.postMessage(event.data); - } + if (hasCloseButton) { + if (msg.Values && msg.Values.EverModified) { + let reply = { MessageId: "Action_Close" }; + postMessage(reply); + } + if (window.parent.location == window.location) { + history.back(); + } else { + /* we send back the UI_Close message to the parent frame. */ + window.parent.postMessage(event.data); } - break; - } + } + break; + } } diff --git a/js/previewer.js b/js/previewer.js index fdf072c5..eebdb781 100644 --- a/js/previewer.js +++ b/js/previewer.js @@ -10,35 +10,35 @@ */ function previewField(coolUrl) { - let iframe = document.querySelector("#cool-editor__dialog > .cool-frame__preview"); - iframe.src = coolUrl; - document.querySelector("#cool-editor__dialog").show(); + let iframe = document.querySelector("#cool-editor__dialog > .cool-frame__preview"); + iframe.src = coolUrl; + document.querySelector("#cool-editor__dialog").show(); } function closePreview() { - let iframe = document.querySelector("#cool-editor__dialog > .cool-frame__preview"); - iframe.src = "about:blank"; - document.querySelector('#cool-editor__dialog').close(); + let iframe = document.querySelector("#cool-editor__dialog > .cool-frame__preview"); + iframe.src = "about:blank"; + document.querySelector('#cool-editor__dialog').close(); } (function () { - function receiveMessage(event) { - let msg = JSON.parse(event.data); - if (!msg) { - return; - } + function receiveMessage(event) { + let msg = JSON.parse(event.data); + if (!msg) { + return; + } - switch (msg.MessageId) { - case "App_LoadingStatus": - if (msg.Values && msg.Values.Status == "Document_Loaded") { - postReady(); - } - break; - case "UI_Close": - closePreview(); - break; + switch (msg.MessageId) { + case "App_LoadingStatus": + if (msg.Values && msg.Values.Status == "Document_Loaded") { + postReady(); } + break; + case "UI_Close": + closePreview(); + break; } + } - window.addEventListener("message", receiveMessage, false); + window.addEventListener("message", receiveMessage, false); })()