diff options
Diffstat (limited to 'core/src/OCP')
-rw-r--r-- | core/src/OCP/accessibility.js | 28 | ||||
-rw-r--r-- | core/src/OCP/appconfig.js | 25 | ||||
-rw-r--r-- | core/src/OCP/collaboration.js | 24 | ||||
-rw-r--r-- | core/src/OCP/comments.js | 26 | ||||
-rw-r--r-- | core/src/OCP/index.js | 37 | ||||
-rw-r--r-- | core/src/OCP/loader.js | 29 | ||||
-rw-r--r-- | core/src/OCP/toast.js | 24 | ||||
-rw-r--r-- | core/src/OCP/whatsnew.js | 22 |
8 files changed, 62 insertions, 153 deletions
diff --git a/core/src/OCP/accessibility.js b/core/src/OCP/accessibility.js new file mode 100644 index 00000000000..4a1399f3f96 --- /dev/null +++ b/core/src/OCP/accessibility.js @@ -0,0 +1,28 @@ +/** + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { loadState } from '@nextcloud/initial-state' + +/** + * Set the page heading + * + * @param {string} heading page title from the history api + * @since 27.0.0 + */ +export function setPageHeading(heading) { + const headingEl = document.getElementById('page-heading-level-1') + if (headingEl) { + headingEl.textContent = heading + } +} +export default { + /** + * @return {boolean} Whether the user opted-out of shortcuts so that they should not be registered + */ + disableKeyboardShortcuts() { + return loadState('theming', 'shortcutsDisabled', false) + }, + setPageHeading, +} diff --git a/core/src/OCP/appconfig.js b/core/src/OCP/appconfig.js index 57e13048fe0..78f94922d53 100644 --- a/core/src/OCP/appconfig.js +++ b/core/src/OCP/appconfig.js @@ -1,30 +1,13 @@ /** - * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-or-later */ import $ from 'jquery' import { generateOcsUrl } from '@nextcloud/router' -import OC from '../OC/index' +import OC from '../OC/index.js' /** * @param {string} method 'post' or 'delete' diff --git a/core/src/OCP/collaboration.js b/core/src/OCP/collaboration.js index 2e49cebe9f1..82ff34392cf 100644 --- a/core/src/OCP/collaboration.js +++ b/core/src/OCP/collaboration.js @@ -1,31 +1,13 @@ /** - * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Julius Härtl <jus@bitgrid.net> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import escapeHTML from 'escape-html' /** * @typedef TypeDefinition - * @function {Function} action This action is executed to let the user select a resource + * @function action This action is executed to let the user select a resource * @param {string} icon Contains the icon css class for the type * @function Object() { [native code] } */ diff --git a/core/src/OCP/comments.js b/core/src/OCP/comments.js index ed7ac67a073..34699a477d1 100644 --- a/core/src/OCP/comments.js +++ b/core/src/OCP/comments.js @@ -1,24 +1,6 @@ /** - * @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import $ from 'jquery' @@ -31,8 +13,10 @@ import $ from 'jquery' * * The downside: anything not ascii is excluded. Not sure how common it is in areas using different * alphabets… the upside: fake domains with similar looking characters won't be formatted as links + * + * This is a copy of the backend regex in IURLGenerator, make sure to adjust both when changing */ -const urlRegex = /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig +const urlRegex = /(\s|^)(https?:\/\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig /** * @param {any} content - diff --git a/core/src/OCP/index.js b/core/src/OCP/index.js index a6a5fe3e127..94f4e8e5eb3 100644 --- a/core/src/OCP/index.js +++ b/core/src/OCP/index.js @@ -1,39 +1,22 @@ /** - * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Julius Härtl <jus@bitgrid.net> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import { loadState } from '@nextcloud/initial-state' -import * as AppConfig from './appconfig' -import * as Comments from './comments' -import * as WhatsNew from './whatsnew' +import * as AppConfig from './appconfig.js' +import * as Comments from './comments.js' +import * as WhatsNew from './whatsnew.js' -import Collaboration from './collaboration' -import Loader from './loader' -import Toast from './toast' +import Accessibility from './accessibility.js' +import Collaboration from './collaboration.js' +import Loader from './loader.js' +import Toast from './toast.js' /** @namespace OCP */ export default { + Accessibility, AppConfig, Collaboration, Comments, diff --git a/core/src/OCP/loader.js b/core/src/OCP/loader.js index 6e58208a849..d307eb27996 100644 --- a/core/src/OCP/loader.js +++ b/core/src/OCP/loader.js @@ -1,27 +1,10 @@ /** - * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Julius Härtl <jus@bitgrid.net> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ +import { generateFilePath } from '@nextcloud/router' + const loadedScripts = {} const loadedStylesheets = {} /** @@ -44,7 +27,7 @@ export default { } loadedScripts[key] = true return new Promise(function(resolve, reject) { - const scriptPath = OC.filePath(app, 'js', file) + const scriptPath = generateFilePath(app, 'js', file) const script = document.createElement('script') script.src = scriptPath script.setAttribute('nonce', btoa(OC.requestToken)) @@ -68,7 +51,7 @@ export default { } loadedStylesheets[key] = true return new Promise(function(resolve, reject) { - const stylePath = OC.filePath(app, 'css', file) + const stylePath = generateFilePath(app, 'css', file) const link = document.createElement('link') link.href = stylePath link.type = 'text/css' diff --git a/core/src/OCP/toast.js b/core/src/OCP/toast.js index 40c46aa8f51..f93344bbc8e 100644 --- a/core/src/OCP/toast.js +++ b/core/src/OCP/toast.js @@ -1,24 +1,6 @@ /** - * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Julius Härtl <jus@bitgrid.net> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import { @@ -28,6 +10,8 @@ import { showWarning, } from '@nextcloud/dialogs' +/** @typedef {import('toastify-js')} Toast */ + export default { /** * @deprecated 19.0.0 use `showSuccess` from the `@nextcloud/dialogs` package instead diff --git a/core/src/OCP/whatsnew.js b/core/src/OCP/whatsnew.js index aafe1740e0d..acada6a8383 100644 --- a/core/src/OCP/whatsnew.js +++ b/core/src/OCP/whatsnew.js @@ -1,24 +1,6 @@ /** - * @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import _ from 'underscore' |