This commit is contained in:
Alexander Trofimov
2015-06-25 11:27:08 +03:00
parent dbf21ee32f
commit a10605c91f
174 changed files with 24121 additions and 8908 deletions

View File

@@ -30,7 +30,8 @@
*
*/
var ApplicationController = new(function () {
var me, api, docConfig = {},
var me, api, config = {},
docConfig = {},
embedConfig = {},
permissions = {},
maxPages = 0,
@@ -40,6 +41,7 @@
embedCode = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="{embed-url}" width="{width}" height="{height}"></iframe>',
maxZIndex = 9090,
created = false;
Common.Analytics.initialize("UA-12442749-13", "Embedded ONLYOFFICE Presentation");
if (typeof isBrowserSupported !== "undefined" && !isBrowserSupported()) {
Common.Gateway.reportError(undefined, "Your browser is not supported.");
return;
@@ -77,6 +79,7 @@
}
}
function loadConfig(data) {
config = $.extend(config, data.config);
embedConfig = $.extend(embedConfig, data.config.embedded);
$("#id-short-url").text(embedConfig.shareUrl || "Unavailable");
$("#id-textarea-embed").text(embedCode.replace("{embed-url}", embedConfig.embedUrl).replace("{width}", minEmbedWidth).replace("{height}", minEmbedHeight));
@@ -96,7 +99,7 @@
if (typeof embedConfig.fullscreenUrl === "undefined") {
$("#id-btn-fullscreen").hide();
}
if (typeof data.config.canBackToFolder === "undefined" || !data.config.canBackToFolder) {
if (typeof config.canBackToFolder === "undefined" || !config.canBackToFolder) {
$("#id-btn-close").hide();
}
if (embedConfig.toolbarDocked === "top") {
@@ -122,6 +125,8 @@
docInfo.put_Format(docConfig.fileType);
docInfo.put_VKey(docConfig.vkey);
if (api) {
api.asc_registerCallback("asc_onGetEditorPermissions", onEditorPermissions);
api.asc_getEditorPermissions();
api.asc_enableKeyEvents(true);
api.SetViewMode(true);
api.LoadDocument(docInfo);
@@ -204,6 +209,15 @@
hidePreloader();
Common.Analytics.trackEvent("Load", "Complete");
}
function onEditorPermissions(params) {
if (params.asc_getCanBranding() && (typeof config.customization == "object") && config.customization && config.customization.logoUrlEmbedded) {
$("#header-logo").css({
"background-image": 'url("' + config.customization.logoUrlEmbedded + '")',
"background-position": "0 center",
"background-repeat": "no-repeat"
});
}
}
function showMask() {
$("#id-loadmask").modal({
backdrop: "static",