diff --git a/README.md b/README.md index a2e8eaa2dc7360b921da5aadf4840483ec3e685e..68704d01252bf5d6080b188610881475b078e769 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# multi-office - +# Multi Office diff --git a/appinfo/info.xml b/appinfo/info.xml index 954588726be6a96588a29d02089cefe828689fbc..bbbf3b4d2894a8b93cb070a4c087b0cdcc455120 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -14,10 +14,4 @@ - - - Multi Office - multioffice.page.index - - diff --git a/composer.json b/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..7ef3d1634804f2bcf6c7bbf822c8d5ecdd96e97f --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "Multi Office", + "description": "Improve Collabora + ONLYOFFICE experience", + "type": "project", + "license": "AGPL", + "authors": [ + { + "name": "Indiehosters" + } + ], + "require": {}, + "require-dev": {} +} diff --git a/css/style.css b/css/style.css index 1a089aa1f698c13e8b9fcb33aee0e4f56e36fa76..51247c45a39119610c8882e2381dda15110fe444 100644 --- a/css/style.css +++ b/css/style.css @@ -24,7 +24,7 @@ } .menu-item-extension { - margin-left: auto; + margin-left: 1em; opacity: 0.4; font-weight: bold; font-size: 0.8em; diff --git a/img/app.svg b/img/app.svg new file mode 100644 index 0000000000000000000000000000000000000000..fe370f80dafdf27d8e8ed20fa97b3cc8bfb65705 --- /dev/null +++ b/img/app.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/js/script.js b/js/script.js index 7e10fd838df04141a81cfec095f6fad36e1e908d..d14d5e5eabf8a8af8a3cb06dd7e108685b65188f 100644 --- a/js/script.js +++ b/js/script.js @@ -1,48 +1,50 @@ -OC.Plugins.register("OCA.Files.NewFileMenu", { - attach: function () { - const refreshMenu = () => { - const menu = document.querySelector(".newFileMenu ul"); +document.addEventListener("DOMContentLoaded", () => + OC.Plugins.register("OCA.Files.NewFileMenu", { + attach: function () { + const refreshMenu = () => { + const menu = document.querySelector(".newFileMenu ul"); - const addSeparator = (selector, title) => { - const firtEl = document.querySelector(selector); + const addSeparator = (selector, title) => { + const firtEl = document.querySelector(selector); - const separator = document.createElement("li"); - separator.classList.add("menu-item-separator"); - separator.innerHTML = ` + const separator = document.createElement("li"); + separator.classList.add("menu-item-separator"); + separator.innerHTML = `

${title}

`; - menu.insertBefore(separator, firtEl.parentNode); - }; + menu.insertBefore(separator, firtEl.parentNode); + }; - const addExtension = (selector) => { - const elements = document.querySelectorAll(selector); - for (const el of elements) { - const span = document.createElement("span"); - span.classList.add("menu-item-extension"); - span.innerText = el.getAttribute("data-templatename").split(".")[1]; - el.appendChild(span); - } - }; + const addExtension = (selector) => { + const elements = document.querySelectorAll(selector); + for (const el of elements) { + const span = document.createElement("span"); + span.classList.add("menu-item-extension"); + span.innerText = el.getAttribute("data-templatename").split(".")[1]; + el.appendChild(span); + } + }; - addSeparator( - '.newFileMenu .menuitem[data-action*="template-new-onlyoffice"]', - "ONLYOFFICE" - ); - addSeparator( - '.newFileMenu .menuitem[data-action*="template-new-richdocument"]', - "LIBREOFFICE" - ); + addSeparator( + '.newFileMenu .menuitem[data-action*="template-new-onlyoffice"]', + "ONLYOFFICE" + ); + addSeparator( + '.newFileMenu .menuitem[data-action*="template-new-richdocument"]', + "LIBREOFFICE" + ); - addExtension( - '.newFileMenu .menuitem[data-action*="template-new-onlyoffice"]' - ); - addExtension( - '.newFileMenu .menuitem[data-action*="template-new-richdocument"]' - ); - }; - setTimeout(refreshMenu); - document.querySelector(".new").addEventListener("click", refreshMenu); - }, -}); + addExtension( + '.newFileMenu .menuitem[data-action*="template-new-onlyoffice"]' + ); + addExtension( + '.newFileMenu .menuitem[data-action*="template-new-richdocument"]' + ); + }; + setTimeout(refreshMenu); + document.querySelector(".new").addEventListener("click", refreshMenu); + }, + }) +); diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php new file mode 100644 index 0000000000000000000000000000000000000000..9cae642af4db0cc43b9c7581300056f0a9c70679 --- /dev/null +++ b/lib/AppInfo/Application.php @@ -0,0 +1,20 @@ +getEventDispatcher(); + $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() { + script('multioffice', 'script'); + style('multioffice', 'style'); + }); + } + +}