Skip to content

Commit

Permalink
append share button when don't redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Antipkin-A committed Oct 20, 2021
1 parent 08d7671 commit 3c12e06
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,17 @@
return;
}

if (oc_appswebroots.richdocuments
|| oc_appswebroots.files_pdfviewer && extension === "pdf"
|| oc_appswebroots.files_texteditor && extension === "txt") {
var redirect = true;
var flag = /\?redirect=([\w-]{1})/.exec(location.search);
if (flag && flag.length > 0 && flag[1] === "0") {
redirect = false;
}

var isThirdPartyApps = oc_appswebroots.richdocuments
|| oc_appswebroots.files_pdfviewer && extension === "pdf"
|| oc_appswebroots.files_texteditor && extension === "txt";

if (!redirect || isThirdPartyApps) {
var button = document.createElement("button");
button.className = "onlyoffice-public-open button";
button.innerText = t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE");
Expand All @@ -457,16 +464,10 @@
button.addEventListener("click", function(event) {
OCA.Onlyoffice.OpenEditor();
});
} else {
var redirect = true;
var flag = /\?redirect=([\w-]{1})/.exec(location.search);
if (flag && flag.length > 0 && flag[1] === "0") {
redirect = false;
}
}

if (redirect) {
OCA.Onlyoffice.OpenEditor(0, "", "", 0, null, redirect);
}
if (redirect && !isThirdPartyApps) {
OCA.Onlyoffice.OpenEditor(0, "", "", 0, null, redirect);
}
};

Expand Down

0 comments on commit 3c12e06

Please sign in to comment.