Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2018-03-20 13:23:06 +0300
committerSergey Linnik <sergey.linnik@onlyoffice.com>2018-03-20 14:08:25 +0300
commitd473501c9b09b7cf425983ac92de9e1c03b2daee (patch)
tree18fa844ea5256bb755757f27fb18c04777492136 /js
parentc5237c3e01c58c56daf4a1cada6521110c65a674 (diff)
main script on share link page
Diffstat (limited to 'js')
-rw-r--r--js/main.js31
-rw-r--r--js/public.js71
2 files changed, 29 insertions, 73 deletions
diff --git a/js/main.js b/js/main.js
index b3bfefd..257f0d9 100644
--- a/js/main.js
+++ b/js/main.js
@@ -224,8 +224,35 @@
};
- OC.Plugins.register("OCA.Files.FileList", OCA.Onlyoffice.FileList);
- OC.Plugins.register("OCA.Files.NewFileMenu", OCA.Onlyoffice.NewFileMenu);
+ if ($("#isPublic").val()) {
+ if (!$("#dir").val().length) {
+ var fileName = $("#filename").val();
+ var extension = fileName.substr(fileName.lastIndexOf(".") + 1);
+
+ var initSharedButton = function() {
+ var mimes = OCA.Onlyoffice.setting.formats;
+
+ var conf = mimes[extension];
+ if (conf) {
+ var button = document.createElement("a");
+ button.href = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/" + $("#sharingToken").val());
+ button.className = "button";
+ button.innerText = t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE")
+
+ if (!OCA.Onlyoffice.setting.sameTab) {
+ button.target = "_blank";
+ }
+
+ $("#preview").append(button);
+ }
+ };
+
+ OCA.Onlyoffice.GetSettings(initSharedButton);
+ }
+ } else {
+ OC.Plugins.register("OCA.Files.FileList", OCA.Onlyoffice.FileList);
+ OC.Plugins.register("OCA.Files.NewFileMenu", OCA.Onlyoffice.NewFileMenu);
+ }
})(OCA);
diff --git a/js/public.js b/js/public.js
deleted file mode 100644
index e234735..0000000
--- a/js/public.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- *
- * (c) Copyright Ascensio System Limited 2010-2018
- *
- * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
- * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
- * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
- *
- * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
- * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
- *
- * You can contact Ascensio System SIA by email at sales@onlyoffice.com
- *
- * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
- * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
- *
- * Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
- * relevant author attributions when distributing the software. If the display of the logo in its graphic
- * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
- * in every copy of the program you distribute.
- * Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
- *
- */
-
-(function ($, OCA) {
-
- OCA.Onlyoffice = _.extend({}, OCA.Onlyoffice);
- if (!OCA.Onlyoffice.AppName) {
- OCA.Onlyoffice = {
- AppName: "onlyoffice"
- };
- }
-
- OCA.Onlyoffice.setting = {};
-
- OCA.Onlyoffice.InitPublic = function () {
-
- if (!!$("#dir").val().length) {
- return;
- }
-
- var fileName = $("#filename").val();
- var extension = fileName.substr(fileName.lastIndexOf('.') + 1);
-
- $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/settings"),
- function onSuccess(settings) {
- OCA.Onlyoffice.setting = settings;
- var mimes = OCA.Onlyoffice.setting.formats;
-
- OCA.Onlyoffice.mimes = mimes;
- var conf = OCA.Onlyoffice.mimes[extension];
- if (conf) {
- var button = document.createElement("a");
- button.href = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/" + $('#sharingToken').val());
- button.className = "button";
- button.innerText = t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE")
-
- if (!OCA.Onlyoffice.setting.sameTab) {
- button.target = "_blank";
- }
-
- $("#preview").append(button);
- }
- }
- );
- };
-
- $(document).ready(OCA.Onlyoffice.InitPublic);
-
-})(jQuery, OCA); \ No newline at end of file