diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-02-14 11:41:49 +0300 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-02-14 11:41:49 +0300 |
commit | ea39d5d0618a0511c38305d12c39080312350dd9 (patch) | |
tree | d2d243a8a1749bbdb9af480248768dabe32733c2 | |
parent | 700a7c23a50d999dcfa8af4bbea8478ef35e3622 (diff) |
Fix regressions and simplify code changesdecrease-latency-file
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r-- | apps/files/js/app.js | 5 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 84 | ||||
-rw-r--r-- | apps/files/js/newfilemenu.js | 5 | ||||
-rw-r--r-- | apps/files/js/sidebarpreviewmanager.js | 5 | ||||
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/Listener/LoadAdditionalListener.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/lib/Listener/LoadSidebarListener.php | 2 |
7 files changed, 61 insertions, 48 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js index 7ac32faa99d..6961d05084b 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -128,7 +128,10 @@ // refer to the one of the "files" view window.FileList = this.fileList; - OC.Plugins.attach('OCA.Files.App', this); + let selfApp = this + window.addEventListener('DOMContentLoaded', function() { + OC.Plugins.attach('OCA.Files.App', selfApp) + }) this._setupEvents(); // trigger URL change event handlers diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 47ec41146d8..71b8b5d930b 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -10,9 +10,45 @@ (function() { /** + * @class OCA.Files.FileList + * @classdesc + * + * The FileList class manages a file list view. + * A file list view consists of a controls bar and + * a file list table. + * + * @param $el container element with existing markup for the #controls + * and a table + * @param {Object} [options] map of options, see other parameters + * @param {Object} [options.scrollContainer] scrollable container, defaults to $(window) + * @param {Object} [options.dragOptions] drag options, disabled by default + * @param {Object} [options.folderDropOptions] folder drop options, disabled by default + * @param {boolean} [options.detailsViewEnabled=true] whether to enable details view + * @param {boolean} [options.enableUpload=false] whether to enable uploader + * @param {OC.Files.Client} [options.filesClient] files client to use + */ + function FileList($el, options) { + this.initialize($el, options); + let filelist = this + + window.addEventListener('DOMContentLoaded', function() { + // FIXME: unused ? + this.useUndo = (window.onbeforeunload)?true:false; + $(window).on('beforeunload', function () { + if (this.lastAction) { + this.lastAction(); + } + }); + if (this._updateDetailsViewTmpFileName && this._updateDetailsViewTmpShow) { + filelist.updateDetailsView(this._updateDetailsViewTmpFileName, this._updateDetailsViewTmpShow) + } + }); + } + + /** * @memberof OCA.Files */ - const FileListPrototype = { + FileList.prototype = { SORT_INDICATOR_ASC_CLASS: 'icon-triangle-n', SORT_INDICATOR_DESC_CLASS: 'icon-triangle-s', @@ -438,11 +474,14 @@ } this.triedActionOnce = false; - OC.Plugins.attach('OCA.Files.FileList', this); + window.addEventListener('DOMContentLoaded', function() { + console.debug('Attaching OCA.Files.FileList', self) + OC.Plugins.attach('OCA.Files.FileList', self); + self.initHeadersAndFooters() + OCA.Files.App && OCA.Files.App.updateCurrentFileList(self); + }) OCA.Files.App && OCA.Files.App.updateCurrentFileList(this); - - this.initHeadersAndFooters() }, initHeadersAndFooters: function() { @@ -3995,43 +4034,6 @@ */ OCA.Files.FileInfo = OC.Files.FileInfo; - /** - * @class OCA.Files.FileList - * @classdesc - * - * The FileList class manages a file list view. - * A file list view consists of a controls bar and - * a file list table. - * - * @param $el container element with existing markup for the #controls - * and a table - * @param {Object} [options] map of options, see other parameters - * @param {Object} [options.scrollContainer] scrollable container, defaults to $(window) - * @param {Object} [options.dragOptions] drag options, disabled by default - * @param {Object} [options.folderDropOptions] folder drop options, disabled by default - * @param {boolean} [options.detailsViewEnabled=true] whether to enable details view - * @param {boolean} [options.enableUpload=false] whether to enable uploader - * @param {OC.Files.Client} [options.filesClient] files client to use - */ - function FileList($el, options) { - this.initialize($el, options); - let filelist = this - - window.addEventListener('DOMContentLoaded', function() { - // FIXME: unused ? - this.useUndo = (window.onbeforeunload)?true:false; - $(window).on('beforeunload', function () { - if (this.lastAction) { - this.lastAction(); - } - }); - if (this._updateDetailsViewTmpFileName && this._updateDetailsViewTmpShow) { - filelist.updateDetailsView(this._updateDetailsViewTmpFileName, this._updateDetailsViewTmpShow) - } - }); - } - - FileList.prototype = FileListPrototype FileList.prototype.constructor = FileList OCA.Files.FileList = FileList; diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js index faebc305c6d..bb7852e5803 100644 --- a/apps/files/js/newfilemenu.js +++ b/apps/files/js/newfilemenu.js @@ -56,7 +56,10 @@ } }]; - OC.Plugins.attach('OCA.Files.NewFileMenu', this); + let selfNewFileMenu = this + window.addEventListener('DOMContentLoaded', function() { + OC.Plugins.attach('OCA.Files.NewFileMenu', selfNewFileMenu); + }) }, template: function(data) { diff --git a/apps/files/js/sidebarpreviewmanager.js b/apps/files/js/sidebarpreviewmanager.js index cb5a7ee9960..4ee3ab3af6b 100644 --- a/apps/files/js/sidebarpreviewmanager.js +++ b/apps/files/js/sidebarpreviewmanager.js @@ -12,7 +12,10 @@ var SidebarPreviewManager = function (fileList) { this._fileList = fileList; this._previewHandlers = {}; - OC.Plugins.attach('OCA.Files.SidebarPreviewManager', this); + let selfSidebarPreview = this + window.addEventListener('DOMContentLoaded', function() { + OC.Plugins.attach('OCA.Files.SidebarPreviewManager', selfSidebarPreview); + }) }; SidebarPreviewManager.prototype = { diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index a8992d5f292..bfd931c0b2a 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -196,7 +196,7 @@ class ViewController extends Controller { // Load the files we need \OCP\Util::addStyle('files', 'merged'); - \OCP\Util::addScript('files', 'merged-index', 'files_sharing'); + \OCP\Util::addScript('files', 'merged-index', 'files'); \OCP\Util::addScript('files', 'main'); // mostly for the home storage's free space diff --git a/apps/files_sharing/lib/Listener/LoadAdditionalListener.php b/apps/files_sharing/lib/Listener/LoadAdditionalListener.php index 959c8cbc469..8c11fec3999 100644 --- a/apps/files_sharing/lib/Listener/LoadAdditionalListener.php +++ b/apps/files_sharing/lib/Listener/LoadAdditionalListener.php @@ -37,8 +37,10 @@ class LoadAdditionalListener implements IEventListener { return; } - Util::addScript(Application::APP_ID, 'files_sharing'); - Util::addScript(Application::APP_ID, 'additionalScripts'); + // After files for the files list shared content + Util::addScript(Application::APP_ID, 'files_sharing', 'files'); + // After files for the breadcrumb share indicator + Util::addScript(Application::APP_ID, 'additionalScripts', 'files'); Util::addStyle(Application::APP_ID, 'icons'); } } diff --git a/apps/files_sharing/lib/Listener/LoadSidebarListener.php b/apps/files_sharing/lib/Listener/LoadSidebarListener.php index 15f6391a577..cb5ebf8a792 100644 --- a/apps/files_sharing/lib/Listener/LoadSidebarListener.php +++ b/apps/files_sharing/lib/Listener/LoadSidebarListener.php @@ -37,6 +37,6 @@ class LoadSidebarListener implements IEventListener { return; } - Util::addScript(Application::APP_ID, 'files_sharing_tab'); + Util::addScript(Application::APP_ID, 'files_sharing_tab', 'files'); } } |