diff options
Diffstat (limited to 'core/src/jquery')
-rw-r--r-- | core/src/jquery/avatar.js | 32 | ||||
-rw-r--r-- | core/src/jquery/contactsmenu.js | 33 | ||||
-rw-r--r-- | core/src/jquery/css/jquery-ui-fixes.scss | 46 | ||||
-rw-r--r-- | core/src/jquery/css/jquery.ocdialog.scss | 27 | ||||
-rw-r--r-- | core/src/jquery/exists.js | 25 | ||||
-rw-r--r-- | core/src/jquery/filterattr.js | 22 | ||||
-rw-r--r-- | core/src/jquery/index.js | 42 | ||||
-rw-r--r-- | core/src/jquery/ocdialog.js | 95 | ||||
-rw-r--r-- | core/src/jquery/octemplate.js | 23 | ||||
-rw-r--r-- | core/src/jquery/placeholder.js | 27 | ||||
-rw-r--r-- | core/src/jquery/requesttoken.js | 26 | ||||
-rw-r--r-- | core/src/jquery/selectrange.js | 29 | ||||
-rw-r--r-- | core/src/jquery/showpassword.js | 50 | ||||
-rw-r--r-- | core/src/jquery/ui-fixes.js | 5 |
14 files changed, 202 insertions, 280 deletions
diff --git a/core/src/jquery/avatar.js b/core/src/jquery/avatar.js index 8c17e65e98c..3851a26ce31 100644 --- a/core/src/jquery/avatar.js +++ b/core/src/jquery/avatar.js @@ -1,28 +1,12 @@ -/* - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 { getCurrentUser } from '@nextcloud/auth' +import { generateUrl } from '@nextcloud/router' import $ from 'jquery' -import OC from '../OC' - /** * This plugin inserts the right avatar for the user, depending on, whether a * custom avatar is uploaded - which it uses then - or not, and display a @@ -106,8 +90,8 @@ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) { let url // If this is our own avatar we have to use the version attribute - if (user === OC.getCurrentUser().uid) { - url = OC.generateUrl( + if (user === getCurrentUser()?.uid) { + url = generateUrl( '/avatar/{user}/{size}?v={version}', { user, @@ -115,7 +99,7 @@ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) { version: oc_userconfig.avatar.version, }) } else { - url = OC.generateUrl( + url = generateUrl( '/avatar/{user}/{size}', { user, diff --git a/core/src/jquery/contactsmenu.js b/core/src/jquery/contactsmenu.js index 447f5adb62a..fba014c364e 100644 --- a/core/src/jquery/contactsmenu.js +++ b/core/src/jquery/contactsmenu.js @@ -1,27 +1,12 @@ -/* - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' -import OC from '../OC' +import { generateUrl } from '@nextcloud/router' +import { isA11yActivation } from '../Util/a11y.js' const LIST = '' + '<div class="menu popovermenu menu-left hidden contactsmenu-popover">' @@ -47,7 +32,11 @@ $.fn.contactsMenu = function(shareWith, shareType, appendTo) { appendTo.append(LIST) const $list = appendTo.find('div.contactsmenu-popover') - $div.click(function() { + $div.on('click keydown', function(event) { + if (!isA11yActivation(event)) { + return + } + if (!$list.hasClass('hidden')) { $list.addClass('hidden') $list.hide() @@ -62,7 +51,7 @@ $.fn.contactsMenu = function(shareWith, shareType, appendTo) { } $list.addClass('loaded') - $.ajax(OC.generateUrl('/contactsmenu/findOne'), { + $.ajax(generateUrl('/contactsmenu/findOne'), { method: 'POST', data: { shareType, diff --git a/core/src/jquery/css/jquery-ui-fixes.scss b/core/src/jquery/css/jquery-ui-fixes.scss index 42c684ad510..637f4bfe14b 100644 --- a/core/src/jquery/css/jquery-ui-fixes.scss +++ b/core/src/jquery/css/jquery-ui-fixes.scss @@ -1,3 +1,7 @@ +/** + * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /* Component containers ----------------------------------*/ .ui-widget-content { @@ -5,14 +9,17 @@ background: var(--color-main-background) none; color: var(--color-main-text); } + .ui-widget-content a { color: var(--color-main-text); } + .ui-widget-header { border: none; color: var(--color-main-text); background-image: none; } + .ui-widget-header a { color: var(--color-main-text); } @@ -27,11 +34,13 @@ font-weight: bold; color: #555; } + .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555; } + .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, @@ -43,20 +52,23 @@ font-weight: bold; color: var(--color-main-text); } + .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: var(--color-main-text); } + .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { - border: 1px solid var(--color-primary); + border: 1px solid var(--color-primary-element); background: var(--color-main-background) none; font-weight: bold; color: var(--color-main-text); } + .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { @@ -73,11 +85,13 @@ color: var(--color-text-light); font-weight: 600; } + .ui-state-highlight a, .ui-widget-content .ui-state-highlight a, .ui-widget-header .ui-state-highlight a { color: var(--color-text-lighter); } + .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error { @@ -85,11 +99,13 @@ background: var(--color-error) none; color: #ffffff; } + .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } + .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { @@ -101,20 +117,25 @@ .ui-state-default .ui-icon { background-image: url('images/ui-icons_1d2d44_256x240.png'); } + .ui-state-hover .ui-icon, .ui-state-focus .ui-icon { background-image: url('images/ui-icons_1d2d44_256x240.png'); } + .ui-state-active .ui-icon { background-image: url('images/ui-icons_1d2d44_256x240.png'); } + .ui-state-highlight .ui-icon { background-image: url('images/ui-icons_ffffff_256x240.png'); } + .ui-state-error .ui-icon, .ui-state-error-text .ui-icon { background-image: url('images/ui-icons_ffd27a_256x240.png'); } + .ui-icon.ui-icon-none { display: none; } @@ -126,6 +147,7 @@ background: #666666 url('images/ui-bg_diagonals-thick_20_666666_40x40.png') 50% 50% repeat; opacity: .5; } + .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; @@ -139,8 +161,8 @@ border: none; .ui-tabs-nav.ui-corner-all { - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; + border-end-start-radius: 0; + border-end-end-radius: 0; } .ui-tabs-nav { @@ -185,7 +207,8 @@ .ui-menu-item a { color: var(--color-text-lighter); display: block; - padding: 4px 4px 4px 14px; + padding: 4px; + padding-inline-start: 14px; &.ui-state-focus, &.ui-state-active { box-shadow: inset 4px 0 var(--color-primary-element); @@ -201,8 +224,8 @@ &.ui-corner-all { border-radius: 0; - border-bottom-left-radius: var(--border-radius); - border-bottom-right-radius: var(--border-radius); + border-end-start-radius: var(--border-radius); + border-end-end-radius: var(--border-radius); } .ui-state-hover, .ui-widget-content .ui-state-hover, @@ -223,9 +246,14 @@ } .ui-button.primary { - background-color: var(--color-primary); - color: var(--color-primary-text); - border: 1px solid var(--color-primary-text); + background-color: var(--color-primary-element); + color: var(--color-primary-element-text); + border: 1px solid var(--color-primary-element-text); +} + +// fix ui-buttons on hover +.ui-button:hover { + font-weight:bold !important; } diff --git a/core/src/jquery/css/jquery.ocdialog.scss b/core/src/jquery/css/jquery.ocdialog.scss index b7e762f4cb6..b950d98c381 100644 --- a/core/src/jquery/css/jquery.ocdialog.scss +++ b/core/src/jquery/css/jquery.ocdialog.scss @@ -1,28 +1,34 @@ +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ .oc-dialog { background: var(--color-main-background); color: var(--color-text-light); border-radius: var(--border-radius-large); box-shadow: 0 0 30px var(--color-box-shadow); - padding: 15px; - z-index: 10000; + padding: 24px; + z-index: 100001; font-size: 100%; box-sizing: border-box; min-width: 200px; top: 50%; - left: 50%; + inset-inline-start: 50%; transform: translate(-50%, -50%); max-height: calc(100% - 20px); max-width: calc(100% - 20px); overflow: auto; } + .oc-dialog-title { background: var(--color-main-background); } + .oc-dialog-buttonrow { position: relative; display: flex; background: transparent; - right: 0; + inset-inline-end: 0; bottom: 0; padding: 0; padding-top: 10px; @@ -50,11 +56,14 @@ .oc-dialog-close { position: absolute; - top: 0; - right: 0; + width: 44px !important; + height: 44px !important; + top: 4px; + inset-inline-end: 4px; padding: 25px; - background: var(--icon-close-000) no-repeat center; + background: var(--icon-close-dark) no-repeat center; opacity: .5; + border-radius: var(--border-radius-pill); &:hover, &:focus, @@ -66,10 +75,10 @@ .oc-dialog-dim { background-color: #000; opacity: .2; - z-index: 9999; + z-index: 100001; position: fixed; top: 0; - left: 0; + inset-inline-start: 0; width: 100%; height: 100%; } diff --git a/core/src/jquery/exists.js b/core/src/jquery/exists.js index 3481faeb6cd..8a8efdb5a63 100644 --- a/core/src/jquery/exists.js +++ b/core/src/jquery/exists.js @@ -1,22 +1,6 @@ /** - * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' @@ -24,8 +8,9 @@ import $ from 'jquery' /** * check if an element exists. * allows you to write if ($('#myid').exists()) to increase readability - * @link http://stackoverflow.com/questions/31044/is-there-an-exists-function-for-jquery - * @returns {boolean} + * + * @see {@link http://stackoverflow.com/questions/31044/is-there-an-exists-function-for-jquery} + * @return {boolean} */ $.fn.exists = function() { return this.length > 0 diff --git a/core/src/jquery/filterattr.js b/core/src/jquery/filterattr.js index 204d04b46a0..f577e55e4e0 100644 --- a/core/src/jquery/filterattr.js +++ b/core/src/jquery/filterattr.js @@ -1,22 +1,6 @@ /** - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' @@ -26,7 +10,7 @@ import $ from 'jquery' * * @param {string} attrName attribute name * @param {string} attrValue attribute value - * @returns {Void} + * @return {void} */ $.fn.filterAttr = function(attrName, attrValue) { return this.filter(function() { diff --git a/core/src/jquery/index.js b/core/src/jquery/index.js index aceee5cf87b..f285ba19449 100644 --- a/core/src/jquery/index.js +++ b/core/src/jquery/index.js @@ -1,37 +1,21 @@ /** - * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' -import './avatar' -import './contactsmenu' -import './exists' -import './filterattr' -import './ocdialog' -import './octemplate' -import './placeholder' -import './requesttoken' -import './selectrange' -import './showpassword' -import './ui-fixes' +import './avatar.js' +import './contactsmenu.js' +import './exists.js' +import './filterattr.js' +import './ocdialog.js' +import './octemplate.js' +import './placeholder.js' +import './requesttoken.js' +import './selectrange.js' +import './showpassword.js' +import './ui-fixes.js' import './css/jquery-ui-fixes.scss' import './css/jquery.ocdialog.scss' diff --git a/core/src/jquery/ocdialog.js b/core/src/jquery/ocdialog.js index e08db2530e3..a5f588ec659 100644 --- a/core/src/jquery/ocdialog.js +++ b/core/src/jquery/ocdialog.js @@ -1,25 +1,11 @@ -/* - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' +import { createFocusTrap } from 'focus-trap' +import { isA11yActivation } from '../Util/a11y.js' $.widget('oc.ocdialog', { options: { @@ -42,16 +28,32 @@ $.widget('oc.ocdialog', { this.originalTitle = this.element.attr('title') this.options.title = this.options.title || this.originalTitle - this.$dialog = $('<div class="oc-dialog" />') + this.$dialog = $('<div class="oc-dialog"></div>') .attr({ // Setting tabIndex makes the div focusable tabIndex: -1, role: 'dialog', + 'aria-modal': true, }) .insertBefore(this.element) this.$dialog.append(this.element.detach()) this.element.removeAttr('title').addClass('oc-dialog-content').appendTo(this.$dialog) + // Activate the primary button on enter if there is a single input + if (self.element.find('input').length === 1) { + const $input = self.element.find('input') + $input.on('keydown', function(event) { + if (isA11yActivation(event)) { + if (self.$buttonrow) { + const $button = self.$buttonrow.find('button.primary') + if ($button && !$button.prop('disabled')) { + $button.click() + } + } + } + }) + } + this.$dialog.css({ display: 'inline-block', position: 'fixed', @@ -88,27 +90,15 @@ $.widget('oc.ocdialog', { event.preventDefault() return false } - // If no button is selected we trigger the primary - if ( - self.$buttonrow - && self.$buttonrow.find($(event.target)).length === 0 - ) { - const $button = self.$buttonrow.find('button.primary') - if ($button && !$button.prop('disabled')) { - $button.trigger('click') - } - } else if (self.$buttonrow) { - $(event.target).trigger('click') - } return false } }) this._setOptions(this.options) this._createOverlay() + this._useFocusTrap() }, _init() { - this.$dialog.focus() this._trigger('open') }, _setOption(key, value) { @@ -129,7 +119,7 @@ $.widget('oc.ocdialog', { if (this.$buttonrow) { this.$buttonrow.empty() } else { - const $buttonrow = $('<div class="oc-dialog-buttonrow" />') + const $buttonrow = $('<div class="oc-dialog-buttonrow"></div>') this.$buttonrow = $buttonrow.appendTo(this.$dialog) } if (value.length === 1) { @@ -149,8 +139,10 @@ $.widget('oc.ocdialog', { self.$defaultButton = $button } self.$buttonrow.append($button) - $button.click(function() { - val.click.apply(self.element[0], arguments) + $button.on('click keydown', function(event) { + if (isA11yActivation(event)) { + val.click.apply(self.element[0], arguments) + } }) }) this.$buttonrow.find('button') @@ -167,11 +159,14 @@ $.widget('oc.ocdialog', { break case 'closeButton': if (value) { - const $closeButton = $('<a class="oc-dialog-close"></a>') + const $closeButton = $('<button class="oc-dialog-close"></button>') + $closeButton.attr('aria-label', t('core', 'Close "{dialogTitle}" dialog', { dialogTitle: this.$title || this.options.title })) this.$dialog.prepend($closeButton) - $closeButton.on('click', function() { - self.options.closeCallback && self.options.closeCallback() - self.close() + $closeButton.on('click keydown', function(event) { + if (isA11yActivation(event)) { + self.options.closeCallback && self.options.closeCallback() + self.close() + } }) } else { this.$dialog.find('.oc-dialog-close').remove() @@ -219,7 +214,7 @@ $.widget('oc.ocdialog', { } this.overlay = $('<div>') .addClass('oc-dialog-dim') - .appendTo(contentDiv) + .insertBefore(this.$dialog) this.overlay.on('click keydown keyup', function(event) { if (event.target !== self.$dialog.get(0) && self.$dialog.find($(event.target)).length === 0) { event.preventDefault() @@ -239,6 +234,23 @@ $.widget('oc.ocdialog', { this.overlay = null } }, + _useFocusTrap() { + // Create global stack if undefined + Object.assign(window, { _nc_focus_trap: window._nc_focus_trap || [] }) + + const dialogElement = this.$dialog[0] + this.focusTrap = createFocusTrap(dialogElement, { + allowOutsideClick: true, + trapStack: window._nc_focus_trap, + fallbackFocus: dialogElement, + }) + + this.focusTrap.activate() + }, + _clearFocusTrap() { + this.focusTrap?.deactivate() + this.focusTrap = null + }, widget() { return this.$dialog }, @@ -249,6 +261,7 @@ $.widget('oc.ocdialog', { this.enterCallback = null }, close() { + this._clearFocusTrap() this._destroyOverlay() const self = this // Ugly hack to catch remaining keyup events. diff --git a/core/src/jquery/octemplate.js b/core/src/jquery/octemplate.js index f89e13b000f..cecbe880aa6 100644 --- a/core/src/jquery/octemplate.js +++ b/core/src/jquery/octemplate.js @@ -1,3 +1,8 @@ +/** + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + import $ from 'jquery' import escapeHTML from 'escape-html' @@ -41,14 +46,14 @@ import escapeHTML from 'escape-html' * var contacts = // fetched in some ajax call * * $.each(contacts, function(idx, contact) { - * $contactList.append( - * $tmpl.octemplate({ - * id: contact.getId(), - * name: contact.getDisplayName(), - * email: contact.getPreferredEmail(), - * phone: contact.getPreferredPhone(), - * }); - * ); + * $contactList.append( + * $tmpl.octemplate({ + * id: contact.getId(), + * name: contact.getDisplayName(), + * email: contact.getPreferredEmail(), + * phone: contact.getPreferredPhone(), + * }); + * ); * }); */ /** @@ -84,7 +89,7 @@ const Template = { function(a, b) { const r = o[b] return typeof r === 'string' || typeof r === 'number' ? r : a - } + }, ) } catch (e) { console.error(e, 'data:', data) diff --git a/core/src/jquery/placeholder.js b/core/src/jquery/placeholder.js index 6c5f94313f6..e57951af5e4 100644 --- a/core/src/jquery/placeholder.js +++ b/core/src/jquery/placeholder.js @@ -1,27 +1,10 @@ -/* eslint-disable */ /** - * ownCloud - * - * @author John Molakvoæ - * @copyright 2016-2018 John Molakvoæ <skjnldsv@protonmail.com> - * @author Morris Jobke - * @copyright 2013 Morris Jobke <morris.jobke@gmail.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library 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 library. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2013-2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-or-later */ +/* eslint-disable */ import $ from 'jquery' import md5 from 'blueimp-md5' @@ -137,7 +120,7 @@ const toRgb = (s) => { } String.prototype.toRgb = function() { - console.warn('String.prototype.toRgb is deprecated! It will be removed in Nextcloud 22.') + OC.debug && console.warn('String.prototype.toRgb is deprecated! It will be removed in Nextcloud 22.') return toRgb(this) } diff --git a/core/src/jquery/requesttoken.js b/core/src/jquery/requesttoken.js index 5f15d43aa17..1e9e06515a6 100644 --- a/core/src/jquery/requesttoken.js +++ b/core/src/jquery/requesttoken.js @@ -1,31 +1,15 @@ -/* - * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' -import { getToken } from '../OC/requesttoken' +import { getRequestToken } from '../OC/requesttoken.ts' $(document).on('ajaxSend', function(elm, xhr, settings) { if (settings.crossDomain === false) { - xhr.setRequestHeader('requesttoken', getToken()) + xhr.setRequestHeader('requesttoken', getRequestToken()) xhr.setRequestHeader('OCS-APIREQUEST', 'true') } }) diff --git a/core/src/jquery/selectrange.js b/core/src/jquery/selectrange.js index 3076726024a..a4d8f49ce43 100644 --- a/core/src/jquery/selectrange.js +++ b/core/src/jquery/selectrange.js @@ -1,32 +1,17 @@ /** - * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 $ from 'jquery' /** * select a range in an input field - * @link http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area - * @param {int} start start selection from - * @param {int} end number of char from start - * @returns {Void} + * + * @see {@link http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area} + * @param {number} start start selection from + * @param {number} end number of char from start + * @return {void} */ $.fn.selectRange = function(start, end) { return this.each(function() { diff --git a/core/src/jquery/showpassword.js b/core/src/jquery/showpassword.js index ac0a9556ae8..8d938d7853b 100644 --- a/core/src/jquery/showpassword.js +++ b/core/src/jquery/showpassword.js @@ -1,40 +1,24 @@ -/* - * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at> - * - * @license GNU AGPL version 3 or any later version - * - * 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 */ +/** @typedef {import('jquery')} jQuery */ import $ from 'jquery' -/* -* @name Show Password -* @description -* @version 1.3 -* @requires Jquery 1.5 -* -* @author Jan Jarfalk -* @author-email jan.jarfalk@unwrongest.com -* @author-website http://www.unwrongest.com -* -* @special-thanks Michel Gratton -* -* @licens MIT License - http://www.opensource.org/licenses/mit-license.php -*/ +/** + * @name Show Password + * @description + * @version 1.3.0 + * @requires jQuery 1.5 + * + * @author Jan Jarfalk <jan.jarfalk@unwrongest.com> + * author-website http://www.unwrongest.com + * + * special-thanks Michel Gratton + * + * @license MIT + */ $.fn.extend({ showPassword(c) { diff --git a/core/src/jquery/ui-fixes.js b/core/src/jquery/ui-fixes.js index d70c5579f94..e23464b2f9d 100644 --- a/core/src/jquery/ui-fixes.js +++ b/core/src/jquery/ui-fixes.js @@ -1,3 +1,8 @@ +/** + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + import $ from 'jquery' // Set autocomplete width the same as the related input |